declare module "sdk/models" { export interface API { /** * Runs the [result page](https://livecodes.io/docs/features/result) (after any required compilation for code). * @example * ```ts * import { createPlayground } from "livecodes"; * * createPlayground("#container").then(async (playground) => { * await playground.run(); * // new result page is displayed * }); * ``` */ run: () => Promise; /** * Formats the code. * * By default, the code in all editors (markup, style and script) is formatted. * To format only the active editor, the value `false` should be passed as an argument. * @example * ```ts * import { createPlayground } from "livecodes"; * * createPlayground("#container").then(async (playground) => { * await playground.format(); * // code in editors is formatted * }); * ``` */ format: (allEditors?: boolean) => Promise; /** * Gets a [share url](https://livecodes.io/docs/features/share) for the current project. * * By default, the url has a long query string representing the compressed encoded config object. * If the argument `shortUrl` was set to `true`, a short url is generated. * @example * ```ts * import { createPlayground } from "livecodes"; * * createPlayground("#container").then(async (playground) => { * const longUrl = await playground.getShareUrl(); * const shortUrl = await playground.getShareUrl(true); * }); * ``` */ getShareUrl: (shortUrl?: boolean) => Promise; /** * Gets a [configuration object](https://livecodes.io/docs/configuration/configuration-object) representing the playground state. * * This can be used to restore state if passed as an [EmbedOptions](https://livecodes.io/docs/sdk/js-ts#embed-options) property when [creating playgrounds](https://livecodes.io/docs/sdk/js-ts/#createplayground), * or can be manipulated and loaded in run-time using [`setConfig`](https://livecodes.io/docs/sdk/js-ts#setconfig) method. * @example * ```ts * import { createPlayground } from "livecodes"; * * createPlayground("#container").then(async (playground) => { * const config = await playground.getConfig(); * }); * ``` */ getConfig: (contentOnly?: boolean) => Promise; /** * Loads a new project using the passed configuration object. * @example * ```ts * import { createPlayground } from "livecodes"; * * createPlayground("#container").then(async (playground) => { * const config = { * markup: { * language: "html", * content: "Hello World!", * }, * }; * const newConfig = await playground.setConfig(config); * // new project loaded * }); * ``` */ setConfig: (config: Partial) => Promise; /** * Gets the playground code (including source code, source language and compiled code) for each editor (markup, style, script), in addition to result page HTML. * * See [Code](https://livecodes.io/docs/api/interfaces/Code) for the structure of the returned object. * @example * ```ts * import { createPlayground } from "livecodes"; * * createPlayground("#container").then(async (playground) => { * const code = await playground.getCode(); * * // source code, language and compiled code for the script editor * const { content, language, compiled } = code.script; * * // result page HTML * const result = code.result; * }); * ``` */ getCode: () => Promise; /** * Shows the selected panel. * * See [docs](https://livecodes.io/docs/sdk/js-ts#show) for details. * @example * await playground.show("style"); * await playground.show("toggle-result"); * await playground.show("result", { full: true }); * await playground.show("script"); * await playground.show("result", { zoom: 0.5 }); * await playground.show("console", { full: true }); */ show: (panel: EditorId | 'editor' | 'result' | 'toggle-result' | Tool['name'], options?: { full?: boolean; line?: number; column?: number; zoom?: Config['zoom']; }) => Promise; /** * Runs project [tests](https://livecodes.io/docs/features/tests) (if present) and gets test results. * @example * ```ts * import { createPlayground } from "livecodes"; * * createPlayground("#container").then(async (playground) => { * const { results } = await playground.runTests(); * }); * ``` */ runTests: () => Promise<{ results: TestResult[]; }>; /** * Runs a callback function when code changes. * * @deprecated Use [`watch`](https://livecodes.io/docs/sdk/js-ts#watch) method instead. */ onChange: (fn: (data: { code: Code; config: Config; }) => void) => { remove: () => void; }; /** * Allows to watch for various playground events. * It takes 2 arguments: event name and a callback function that will be called on every event. * * event name can be one of: `"load" | "ready" | "code" | "console" | "tests" | "destroy"` * * In some events, the callback function will be called with an object that supplies relevant data to the callback function (e.g. code, console output, test results). * * The watch method returns an object with a single method (`remove`), which when called will remove the callback from watching further events. * * See [docs](https://livecodes.io/docs/sdk/js-ts#watch) for details. * @example * ```ts * import { createPlayground } from "livecodes"; * * createPlayground("#container").then((playground) => { * const codeWatcher = playground.watch("code", ({ code, config }) => { * // this will run on every code change * console.log("code:", code); * console.log("config:", config); * }); * * const consoleWatcher = playground.watch("console", ({ method, args }) => { * // this will run on every console output * console[method](...args); * }); * * const testsWatcher = playground.watch("tests", ({ results }) => { * // this will run when tests run * results.forEach((testResult) => { * console.log("status:", testResult.status); // "pass", "fail" or "skip" * console.log(testResult.errors); // array of errors as strings * }); * }); * * // then later * codeWatcher.remove(); * consoleWatcher.remove(); * testsWatcher.remove(); * // events are no longer watched * }); * ``` */ watch: WatchFn; /** * Executes custom commands, including: `"setBroadcastToken"` and `"showVersion"`. * * See [docs](https://livecodes.io/docs/sdk/js-ts#exec) for details. */ exec: (command: APICommands, ...args: any[]) => Promise<{ output: any; } | { error: string; }>; /** * Destroys the playground instance, and removes event listeners. * * Further call to any SDK methods throws an error. * @example * ```ts * import { createPlayground } from "livecodes"; * * createPlayground("#container").then(async (playground) => { * await playground.destroy(); * // playground destroyed * // any further SDK call throws an error * }); * ``` */ destroy: () => Promise; } export type WatchFns = WatchLoad | WatchReady | WatchCode | WatchConsole | WatchTests | WatchDestroy; /** * Called when the playground first loads. */ export type WatchLoad = (event: 'load', fn: () => void) => { remove: () => void; }; /** * Called when a new project is loaded (including when [imported](https://livecodes.io/docs/features/import)) and the playground is ready to run. */ export type WatchReady = (event: 'ready', fn: (data: { config: Config; }) => void) => { remove: () => void; }; /** * Called when the playground "content" is changed (see [`getCode`](https://livecodes.io/docs/sdk/js-ts#getcode) and [`getConfig`](https://livecodes.io/docs/sdk/js-ts#getcode)). * * This includes changes in: * - Code (in editors) * - Editor [languages](https://livecodes.io/docs/languages/) * - [CSS processors](https://livecodes.io/docs/features/css#css-processors) * - [External resources](https://livecodes.io/docs/features/external-resources) * - Project info (e.g. allows adding content in page head and attributes to `` element) * - [Custom settings](https://livecodes.io/docs/advanced/custom-settings) (e.g. allows changing [import maps](https://livecodes.io/docs/features/module-resolution#custom-module-resolution)) * - Project title * - [Test](https://livecodes.io/docs/features/tests) code */ export type WatchCode = (event: 'code', fn: (data: { code: Code; config: Config; }) => void) => { remove: () => void; }; export type WatchConsole = (event: 'console', fn: (data: { method: string; args: any[]; }) => void) => { remove: () => void; }; export type WatchTests = (event: 'tests', fn: (data: { results: TestResult[]; error?: string; }) => void) => { remove: () => void; }; export type WatchDestroy = (event: 'destroy', fn: () => void) => { remove: () => void; }; export type SDKEvent = Parameters[0]; export type SDKEventHandler = Parameters[1]; export type UnionToIntersection = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never; export type Prettify = { [K in keyof T]: T[K] extends object ? Prettify : T[K]; } & {}; export type WatchFn = UnionToIntersection; export type APICommands = 'setBroadcastToken' | 'showVersion'; /** * An object that represents the LiveCodes playground instance. * * The object exposes multiple [methods](https://livecodes.io/docs/sdk/js-ts/#sdk-methods) that can be used to interact with the playground. * * See [docs](https://livecodes.io/docs/sdk/js-ts) for details. */ export interface Playground extends API { /** * Loads the playground, if not already loaded. * * When the embed option [loading](https://livecodes.io/docs/sdk/js-ts#loading) is set to `"click"`, the playground is not loaded automatically. * Instead, a screen is shown with "Click to load" button. Calling the SDK method `load()` allows loading the playground. * * If the playground was not loaded, calling any other method will load the playground first before executing. */ load: () => Promise; } /** * An object that represents the playground embed options. * * See [docs](https://livecodes.io/docs/sdk/js-ts/#embed-options) for details. */ export interface EmbedOptions { /** * Allows loading the playground from a custom URL * (e.g. a [self-hosted app](https://livecodes.io/docs/features/self-hosting) or a [permanent URL](https://livecodes.io/docs/features/permanent-url)). * * If supplied with an invalid URL, an error is thrown. * @default 'https://livecodes.io' */ appUrl?: string; /** * An object that represents the [URL Query parameters](https://livecodes.io/docs/configuration/query-params), that can be used to configure the playground. * * These 2 snippets produce similar output: * * ```js * import { createPlayground } from 'livecodes'; * * // use config * createPlayground('#container', { * config: { * markup: { * language: 'markdown', * content: '# Hello World!', * }, * }, * }); * * // use params * createPlayground('#container', { params: { md: '# Hello World!' } }); * ``` */ params?: Prettify; /** * A [configuration object](https://livecodes.io/docs/configuration/configuration-object) or a URL to a JSON file representing a configuration object to load. * * If supplied and is not an object or a valid URL, an error is thrown. * @default {} */ config?: Partial | string; /** * If `true`, the playground is loaded in [headless mode](https://livecodes.io/docs/sdk/headless). * @default false */ headless?: boolean; /** * A resource to [import](https://livecodes.io/docs/features/import) (from any of the supported [sources](https://livecodes.io/docs/features/import#sources)). */ import?: string; /** * @deprecated * * Use `{ config: { mode: "lite" } }` instead * * If `true`, the playground is loaded in [lite mode](https://livecodes.io/docs/features/lite). * @default false */ lite?: boolean; /** * Sets how the playground loads: * * - `"eager"`: The playground loads immediately. * - `"lazy"`: A playground embedded low down in the page will not load until the user scrolls so that it approaches the viewport. * - `"click"`: The playground does not load automatically. Instead, a "Click-to-load" screen is shown. * @default "lazy" */ loading?: 'lazy' | 'click' | 'eager'; /** * A [starter template](https://livecodes.io/docs/features/templates) to load. * Allowed valued can be found [here](https://livecodes.io/docs/api/internal/type-aliases/TemplateName). */ template?: TemplateName; /** * @deprecated * * The `view` option has been moved to `config.view`. * For headless mode use `headless: true`. * * The [default view](https://livecodes.io/docs/features/default-view) for the playground. * * When set to `"headless"`, the playground is loaded in [headless mode](https://livecodes.io/docs/sdk/headless). * @default "split" */ view?: 'split' | 'editor' | 'result' | 'headless'; } /** * The playground [configuration object](https://livecodes.io/docs/configuration/configuration-object). * * It is an object that holds the configuration and state of the playground. * * See [docs](https://livecodes.io/docs/configuration/configuration-object) for details. */ export interface Config extends ContentConfig, AppConfig, UserConfig { } /** * The properties that define the content of the current [project](https://livecodes.io/docs/features/projects). */ export interface ContentConfig { /** * Project title. * This is used as [result page](https://livecodes.io/docs/features/result) title and title meta tag. * Also used in project search. * @default "Untitled Project" */ title: string; /** * Project description. Used in [project](https://livecodes.io/docs/features/projects) search * and [result page](https://livecodes.io/docs/features/result) description meta tag. * @default "" */ description: string; /** * Content added to the [result page](https://livecodes.io/docs/features/result) `` element. * @default '\n' */ head: string; /** * Attributes added to the [result page](https://livecodes.io/docs/features/result) `` element. * It can be an object or a string. * @example Both of these become `` * { lang: "en", class: "dark" } * 'lang="en" class="dark"' */ htmlAttrs: Record | string; /** * Project tags. * Used in [project](https://livecodes.io/docs/features/projects) filter and search. * @default [] */ tags: string[]; /** * Selects the active editor to show. * * Defaults to the last used editor for user, otherwise `"markup"` * @type {`"markup"` | `"style"` | `"script"` | `undefined`} */ activeEditor: EditorId | undefined; /** * List of enabled languages. * * Defaults to all supported languages in full app and only current editor languages in [embeds](https://livecodes.io/docs/features/embeds). */ languages: Array | undefined; /** * An object that configures the language and content of the markup editor. * * See [docs](https://livecodes.io/docs/configuration/configuration-object/#markup) for details. * @default { language: "html", content: "" } */ markup: Prettify; /** * An object that configures the language and content of the style editor. * * See [docs](https://livecodes.io/docs/configuration/configuration-object/#markup) for details. * @default { language: "css", content: "" } */ style: Prettify; /** * An object that configures the language and content of the script editor. * * See [docs](https://livecodes.io/docs/configuration/configuration-object/#markup) for details. * @default { language: "javascript", content: "" } */ script: Prettify; /** * List of URLs for [external stylesheets](https://livecodes.io/docs/features/external-resources) to add to the [result page](https://livecodes.io/docs/features/result). */ stylesheets: string[]; /** * List of URLs for [external scripts](https://livecodes.io/docs/features/external-resources) to add to the [result page](https://livecodes.io/docs/features/result). */ scripts: string[]; /** * [CSS Preset](https://livecodes.io/docs/features/external-resources#css-presets) to use. * @type {"" | "normalize.css" | "reset-css"} */ cssPreset: CssPresetId; /** * List of enabled [CSS processors](https://livecodes.io/docs/features/css/#css-processors). * * For the list of available processors, see [Processor](https://livecodes.io/docs/api/internal/type-aliases/Processor) */ processors: Processor[]; /** * Defines [custom settings](https://livecodes.io/docs/advanced/custom-settings) for the current project. */ customSettings: Prettify; /** * Allows specifying custom [import maps](https://github.com/WICG/import-maps) for [module imports](https://livecodes.io/docs/features/module-resolution#custom-module-resolution). * * **Example** * * Setting `imports` like this: * ```js * "imports": { * "moment": "https://cdn.jsdelivr.net/npm/moment@2.29.4/dist/moment.js" * } * ``` * results in the following import map: * ```html * * ``` * See docs for [Imports](https://livecodes.io/docs/configuration/configuration-object#imports) * and [Custom Module Resolution](https://livecodes.io/docs/features/module-resolution/#custom-module-resolution) */ imports: { [key: string]: string; }; /** * Allows providing custom TypeScript type declarations for better [editor intellisense](https://livecodes.io/docs/features/intellisense). * * It is an object where each key represents module name and value represents the types. * * See docs for [Types](https://livecodes.io/docs/configuration/configuration-object#types) * and [Custom Types](https://livecodes.io/docs/features/intellisense#custom-types) * * @example * ```js * { * "types": { * "my-demo-lib": "https://my-custom-domain/my-type-declarations.d.ts" * } * } * ``` * @example * ``` * { * "types": { * "my-demo-lib": { * "url": "https://my-custom-domain/types.d.ts", * "autoload": true, * "declareAsModule": true * } * } * ``` */ types: Prettify; /** * Configures the [language](https://livecodes.io/docs/features/tests#supported-languages) * and content of [tests](https://livecodes.io/docs/features/tests). */ tests: Prettify> | undefined; /** * This is a read-only property which specifies the current LiveCodes version. * * Version specified in [exported](https://livecodes.io/docs/features/export) projects allows automatically upgrading the project configuration when imported by an app with a newer version. */ readonly version: string; } /** * These are properties that define how the app behaves. */ export interface AppConfig { /** * If `true`, editors are loaded in read-only mode, where the user is not allowed to change the code. * * By default, when readonly is set to true, the light-weight code editor [CodeJar](https://livecodes.io/docs/features/editor-settings#code-editor) is used. * If you wish to use another editor, set the [editor](https://livecodes.io/docs/configuration/configuration-object#editor) property. * @default false */ readonly: boolean; /** * If `false`, the UI will not show the menu that allows changing editor language. * @default true */ allowLangChange: boolean; /** * Sets the [default view](https://livecodes.io/docs/features/default-view) for the playground. * @default "split" */ view?: 'split' | 'editor' | 'result'; /** * Sets the [display mode](https://livecodes.io/docs/features/display-modes). * @default "full" */ mode: 'full' | 'focus' | 'lite' | 'simple' | 'editor' | 'codeblock' | 'result'; /** * Sets enabled and active tools and status of [tools pane](https://livecodes.io/docs/features/tools-pane). * @default { enabled: "all", active: "", status: "" } * @example * ```js * { * "tools": { * "enabled": ["console", "compiled"], * "active": "console", * "status": "open" * } * } * ``` */ tools: Partial<{ enabled: Array | 'all'; active: Tool['name'] | ''; status: ToolsPaneStatus; }>; /** * Sets result page [zoom level](https://livecodes.io/docs/features/result#result-page-zoom). */ zoom: 1 | 0.5 | 0.25; } export interface UserConfig extends EditorConfig, FormatterConfig { /** * If `true`, the result page is automatically updated on code change, * after time [delay](https://livecodes.io/docs/configuration/configuration-object#delay). * @default true */ autoupdate: boolean; /** * If `true`, the project is automatically saved on code change, * after time [delay](https://livecodes.io/docs/configuration/configuration-object#delay). * @default false */ autosave: boolean; /** * If `true`, the project is watched for code changes which trigger tests to auto-run. * @default false */ autotest: boolean; /** * Time delay (in milliseconds) following code change, * after which the result page is updated (if [`autoupdate`](https://livecodes.io/docs/configuration/configuration-object#autoupdate) is `true`) * and/or the project is saved (if [`autosave`](https://livecodes.io/docs/configuration/configuration-object#autosave) is `true`). * @default 1500 */ delay: number; /** * If `true`, the code is automatically [formatted](https://livecodes.io/docs/features/code-format) on saving the project. * @default false */ formatOnsave: boolean; /** * Sets the app layout to horizontal or vertical. * If set to `"responsive"` (the default) or `undefined`, * the layout is vertical in small screens when the playground height is larger than its width, * otherwise horizontal. * @default "responsive" */ layout: 'responsive' | 'horizontal' | 'vertical' | undefined; /** * Enables [recovering last unsaved project](https://livecodes.io/docs/features/recover) when the app is reopened. * @default true */ recoverUnsaved: boolean; /** * Enables [showing element spacing](https://livecodes.io/docs/features/result#show-spacings) in the result page. * @default false */ showSpacing: boolean; /** * If `true`, the [welcome screen](https://livecodes.io/docs/features/welcome) is displayed when the app loads. */ welcome: boolean; /** * Sets the app UI language used. */ appLanguage: AppLanguage | undefined; } export interface EditorConfig { /** * Selects the [code editor](https://livecodes.io/docs/features/editor-settings#code-editor) to use. * * If `undefined` (the default), Monaco editor is used on desktop, * CodeMirror is used on mobile and in `simple` mode, * while CodeJar is used in `codeblock` mode, in `lite` mode and in `readonly` playgrounds. * * If set to `auto`, Monaco editor is used on desktop and CodeMirror is used on mobile regardless of other settings. * * @default undefined */ editor: 'monaco' | 'codemirror' | 'codejar' | 'auto' | undefined; /** * Sets the app [theme](https://livecodes.io/docs/features/themes) to light/dark mode. * @default "dark" */ theme: Theme; /** * Sets the app theme color. * If `undefined`, it is set to `"hsl(214, 40%, 50%)"`. * @default undefined */ themeColor: string | undefined; /** * Sets the [code editor](https://livecodes.io/docs/features/editor-settings) themes. * * See docs for [editor themes](https://livecodes.io/docs/configuration/configuration-object#editortheme) for details. * * @example "vs" * @example "monaco:twilight, codemirror:one-dark" * @example ["vs@light"] * @example ["vs@light", "vs-dark@dark"] * @example ["monaco:vs@light", "codemirror:github-light@light", "dracula@dark"] */ editorTheme: EditorTheme[] | string | undefined; /** * Sets the [code editor](https://livecodes.io/docs/features/editor-settings) font family. */ fontFamily: string | undefined; /** * Sets the font size. * * If `undefined` (the default), the font size is set to 14 for the full app and 12 for [embeds](https://livecodes.io/docs/features/embeds). * @default undefined */ fontSize: number | undefined; /** * If `true`, lines are indented with tabs instead of spaces. * * Also used in [code formatting](https://livecodes.io/docs/features/code-format). * @default false */ useTabs: boolean; /** * The number of spaces per indentation-level. * * Also used in [code formatting](https://livecodes.io/docs/features/code-format). * @default 2 */ tabSize: number; /** * Show line numbers in [code editor](https://livecodes.io/docs/features/editor-settings). * @default true */ lineNumbers: boolean | 'relative'; /** * Enables word-wrap for long lines. * @default false */ wordWrap: boolean; /** * When set to `true`, regions marked by `#region` and `#endregion` comments are folded when the project is loaded. * @default false */ foldRegions: boolean; /** * Use auto-complete to close brackets and quotes. * @default true */ closeBrackets: boolean; /** * Enables [Emmet](https://livecodes.io/docs/features/editor-settings#emmet). * @default true */ emmet: boolean; /** * Sets [editor mode](https://livecodes.io/docs/features/editor-settings#editor-modes). */ editorMode: 'vim' | 'emacs' | undefined; /** * If `true`, [AI code assistant](https://livecodes.io/docs/features/ai) is enabled. * @default false */ enableAI: boolean; } export interface FormatterConfig { /** * If `true`, lines are indented with tabs instead of spaces. * @default false */ useTabs: boolean; /** * The number of spaces per indentation-level. * @default 2 */ tabSize: number; /** * Configures Prettier [code formatter](https://livecodes.io/docs/features/code-format) to use semi-colons. * @default true */ semicolons: boolean; /** * Configures Prettier [code formatter](https://livecodes.io/docs/features/code-format) to use single quotes instead of double quotes. * @default false */ singleQuote: boolean; /** * Configures Prettier [code formatter](https://livecodes.io/docs/features/code-format) to use [trailing commas](https://prettier.io/docs/en/options.html#trailing-commas). * @default true */ trailingComma: boolean; } export interface UserData { id: string; data: Partial<{ sync: { autosync: boolean; repo: string; lastSync: number; }; deploys: { [key: string]: string; }; }>; } export interface AppData { defaultTemplate?: string | null; recentTemplates?: Array<{ name: Template['name']; title: string; }>; recentProjects?: Array<{ id: string; title: string; description: string; }>; language?: Language; snippets?: { language: Language; }; broadcast?: { serverUrl: string; userToken?: string; }; codeToImagePreset?: Record; } /** * Language name, alias or extension. */ export type Language = 'html' | 'htm' | 'markdown' | 'md' | 'mdown' | 'mkdn' | 'mdx' | 'astro' | 'pug' | 'jade' | 'haml' | 'asciidoc' | 'adoc' | 'asc' | 'mustache' | 'handlebars' | 'hbs' | 'ejs' | 'eta' | 'nunjucks' | 'njk' | 'liquid' | 'liquidjs' | 'dot' | 'twig' | 'vento' | 'vto' | 'art-template' | 'art' | 'jinja' | 'bbcode' | 'bb' | 'mjml' | 'diagrams' | 'diagram' | 'graph' | 'plt' | 'richtext' | 'rte' | 'rich' | 'rte.html' | 'css' | 'scss' | 'sass' | 'less' | 'stylus' | 'styl' | 'stylis' | 'postcss' | 'javascript' | 'js' | 'json' | 'babel' | 'es' | 'sucrase' | 'typescript' | 'flow' | 'ts' | 'jsx' | 'tsx' | 'react' | 'react-jsx' | 'react.jsx' | 'react-tsx' | 'react.tsx' | 'react-native' | 'react-native.jsx' | 'react-native-tsx' | 'react-native.tsx' | 'vue' | 'vue3' | 'vue2' | 'vue-app' | 'app.vue' | 'svelte' | 'svelte-app' | 'app.svelte' | 'stencil' | 'stencil.tsx' | 'solid' | 'solid.jsx' | 'solid.tsx' | 'riot' | 'riotjs' | 'malina' | 'malinajs' | 'xht' | 'coffeescript' | 'coffee' | 'livescript' | 'ls' | 'civet' | 'clio' | 'imba' | 'assemblyscript' | 'as' | 'python' | 'py' | 'pyodide' | 'python-wasm' | 'py-wasm' | 'pythonwasm' | 'pywasm' | 'py3' | 'wasm.py' | 'r' | 'rlang' | 'rstats' | 'r-wasm' | 'ruby' | 'rb' | 'ruby-wasm' | 'wasm.rb' | 'rubywasm' | 'go' | 'golang' | 'php' | 'php-wasm' | 'phpwasm' | 'wasm.php' | 'cpp' | 'c' | 'C' | 'cp' | 'cxx' | 'c++' | 'cppm' | 'ixx' | 'ii' | 'hpp' | 'h' | 'cpp-wasm' | 'cppwasm' | 'cwasm' | 'wasm.cpp' | 'clang' | 'clang.cpp' | 'java' | 'csharp' | 'csharp-wasm' | 'cs' | 'cs-wasm' | 'wasm.cs' | 'perl' | 'pl' | 'pm' | 'lua' | 'lua-wasm' | 'luawasm' | 'wasm.lua' | 'teal' | 'tl' | 'fennel' | 'fnl' | 'julia' | 'jl' | 'scheme' | 'scm' | 'commonlisp' | 'common-lisp' | 'lisp' | 'clojurescript' | 'clojure' | 'cljs' | 'clj' | 'cljc' | 'edn' | 'gleam' | 'rescript' | 'res' | 'resi' | 'reason' | 're' | 'rei' | 'ocaml' | 'ml' | 'mli' | 'tcl' | 'wat' | 'wast' | 'webassembly' | 'wasm' | 'Binary' | 'sql' | 'sqlite' | 'sqlite3' | 'pg.sql' | 'pgsql.sql' | 'pgsql' | 'pg' | 'pglite' | 'pglite.sql' | 'postgresql' | 'postgres' | 'postgre.sql' | 'postgresql.sql' | 'prolog.pl' | 'prolog' | 'blockly' | 'blockly.xml' | 'xml' | 'pintora'; export interface Editor { /** * A language name, extension or alias (as defined in [language documentations](https://livecodes.io/docs/languages/)). * * For the list of supported values, see [Language](https://livecodes.io/docs/api/type-aliases/Language) */ language: Language; /** * The initial content of the code editor. * @default "" */ content?: string; /** * A URL to load `content` from. It has to be a valid URL that is CORS-enabled. * * The URL is only fetched if `content` property had no value. */ contentUrl?: string; /** * Hidden content that gets evaluated without being visible in the code editor. * * This can be useful in embedded playgrounds (e.g. for adding helper functions, utilities or tests) */ hiddenContent?: string; /** * A URL to load `hiddenContent` from. It has to be a valid URL that is CORS-enabled. * * The URL is only fetched if `hiddenContent` property had no value. */ hiddenContentUrl?: string; /** * Lines that get folded when the editor loads. * * This can be used for less relevant content. * @example [{ from: 5, to: 8 }, { from: 15, to: 20 }] */ foldedLines?: Array<{ from: number; to: number; }>; /** * If set, this is used as the title of the editor in the UI, * overriding the default title set to the language name * (e.g. `"Python"` can be used instead of `"Py (Wasm)"`). */ title?: string; /** * If `true`, the title of the code editor is hidden, however its code is still evaluated. * * This can be useful in embedded playgrounds (e.g. for hiding unnecessary code). */ hideTitle?: boolean; /** * The order of the editor in the UI. * @default 0 */ order?: number; /** * A CSS selector to load content from [DOM import](https://livecodes.io/docs/features/import#import-code-from-dom). */ selector?: string; /** * The initial position of the cursor in the code editor. * @example {lineNumber: 5, column: 10} */ position?: EditorPosition; } export interface EditorPosition { lineNumber: number; column?: number; } export type EditorId = 'markup' | 'style' | 'script'; export interface Editors { markup: CodeEditor; style: CodeEditor; script: CodeEditor; } export interface EditorLanguages { markup: Language; style: Language; script: Language; } export interface Types { [key: string]: string | { url: string; declareAsModule?: boolean; declareAsGlobal?: boolean; autoload?: boolean; }; } export interface LanguageSpecs { name: Language; title: string; longTitle?: string; info?: boolean; parser?: Parser; formatter?: LanguageFormatter; compiler: Compiler | Language; extensions: Language[]; editor: EditorId; editorLanguage?: Language; preset?: CssPresetId; largeDownload?: boolean; } export interface ProcessorSpecs { name: Processor; title: string; longTitle?: string; info?: string; isPostcssPlugin: boolean; needsHTML?: boolean; compiler: { url: string; factory: (config: Config, baseUrl: string, options: CompileOptions) => CompilerFunction | CompilerFunction[]; }; editor: EditorId; hidden?: boolean; } export type Processor = 'postcss' | 'postcssImportUrl' | 'tailwindcss' | 'windicss' | 'unocss' | 'tokencss' | 'lightningcss' | 'autoprefixer' | 'postcssPresetEnv' | 'cssmodules' | 'purgecss' | 'cssnano'; export type ParserName = 'babel' | 'babel-ts' | 'babel-flow' | 'glimmer' | 'html' | 'markdown' | 'css' | 'scss' | 'less' | 'php' | 'pug' | 'java'; export interface Parser { name: ParserName; plugins?: any[]; pluginUrls: string[]; } export type FormatFn = (value: string, cursorOffset: number, formatterConfig?: Partial) => Promise<{ formatted: string; cursorOffset: number; }>; export interface LanguageFormatter { factory: (baseUrl: string, language: Language) => FormatFn; } export type CssPresetId = '' | 'normalize.css' | 'reset-css'; export interface CssPreset { id: CssPresetId; name: string; url: string; } export interface EditorLibrary { filename: string; content: string; } export interface CompileOptions { html?: string; blockly?: BlocklyContent; forceCompile?: boolean; compileInfo?: CompileInfo; } export interface CompileInfo { cssModules?: Record; modifiedHTML?: string; importedContent?: string; imports?: Record; } export interface CompileResult { code: string; info: CompileInfo; } export type CompilerFunction = (code: string, { config, language, baseUrl, options, worker, }: { config: Config; language: Language | Processor; baseUrl: string; options: CompileOptions; worker?: Worker; }) => Promise; export interface Compiler { dependencies?: Language[]; url?: string; fn?: CompilerFunction; factory: (config: Config, baseUrl: string) => CompilerFunction | Promise; runOutsideWorker?: CompilerFunction; editors?: EditorId[]; styles?: string[] | ((options: { compiled: string; baseUrl: string; config: Config; }) => string[]); scripts?: string[] | ((options: { compiled: string; baseUrl: string; config: Config; }) => string[]); deferScripts?: boolean; inlineScript?: string | ((options: { baseUrl: string; }) => Promise); inlineModule?: string | ((options: { baseUrl: string; }) => Promise); loadAsExternalModule?: boolean; scriptType?: 'module' | 'text/liquid' | 'text/python' | 'text/r' | 'text/ruby-wasm' | 'text/x-uniter-php' | 'text/php-wasm' | 'text/cpp' | 'text/java' | 'text/csharp-wasm' | 'text/perl' | 'text/julia' | 'text/biwascheme' | 'text/commonlisp' | 'text/tcl' | 'text/prolog' | 'application/json' | 'application/lua' | 'text/fennel' | 'application/wasm-uint8'; liveReload?: boolean; aliasTo?: Language; compiledCodeLanguage?: Language; imports?: { [key: string]: string; }; types?: Types; } export interface Compilers { [language: string]: Compiler; } export type Template = Pick & Partial & { name: TemplateName; aliases?: TemplateName[]; thumbnail: string; tools?: Config['tools']; autotest?: Config['autotest']; }; export type TemplateName = 'blank' | 'javascript' | 'typescript' | 'react' | 'react-native' | 'vue2' | 'vue' | 'angular' | 'preact' | 'svelte' | 'solid' | 'lit' | 'stencil' | 'mdx' | 'astro' | 'riot' | 'malina' | 'jquery' | 'backbone' | 'knockout' | 'jest' | 'jest-react' | 'bootstrap' | 'tailwindcss' | 'shadcn-ui' | 'daisyui' | 'd3' | 'phaser' | 'coffeescript' | 'livescript' | 'civet' | 'clio' | 'imba' | 'rescript' | 'reason' | 'ocaml' | 'python' | 'pyodide' | 'python-wasm' | 'r' | 'ruby' | 'ruby-wasm' | 'go' | 'php' | 'php-wasm' | 'cpp' | 'clang' | 'cpp-wasm' | 'java' | 'csharp-wasm' | 'perl' | 'lua' | 'lua-wasm' | 'teal' | 'fennel' | 'julia' | 'scheme' | 'commonlisp' | 'clojurescript' | 'gleam' | 'tcl' | 'markdown' | 'assemblyscript' | 'wat' | 'sql' | 'postgresql' | 'prolog' | 'blockly' | 'diagrams'; export interface Tool { name: 'console' | 'compiled' | 'tests'; title: string; load: () => Promise; onActivate: () => void; onDeactivate: () => void; getEditor?: () => CodeEditor | undefined; } export type ToolsPaneStatus = 'closed' | 'open' | 'full' | 'none' | ''; export type ToolList = Array<{ name: Tool['name']; factory: (config: Config, baseUrl: string, editors: Editors, eventsManager: EventsManager, isEmbed: boolean, runTests: () => Promise) => Tool; }>; export interface Console extends Tool { title: string; log: (...args: any[]) => void; info: (...args: any[]) => void; table: (...args: any[]) => void; warn: (...args: any[]) => void; error: (...args: any[]) => void; clear: (silent?: boolean) => void; evaluate: (code: string) => void; reloadEditor: (config: Config) => Promise; setTheme?: (theme: Theme) => void; } export interface CompiledCodeViewer extends Tool { title: string; update: (language: Language, content: string, label?: string | undefined) => void; reloadEditor: (config: Config) => Promise; } export interface TestViewer extends Tool { title: string; showResults: ({ results, error }: { results: TestResult[]; error?: string; }) => void; resetTests: () => void; clearTests: () => void; } export interface ToolsPane { load: () => Promise; open: () => void; close: () => void; maximize: () => void; hide: () => void; getStatus: () => ToolsPaneStatus; getActiveTool: () => Tool['name']; setActiveTool: (name: Tool['name']) => void; disableTool: (name: Tool['name']) => void; enableTool: (name: Tool['name']) => void; console?: Console; compiled?: CompiledCodeViewer; tests?: TestViewer; } export interface CodeEditor { getValue: () => string; setValue: (value?: string, newState?: boolean) => void; getLanguage: () => Language; setLanguage: (language: Language, value?: string) => void; getEditorId: () => string; focus: () => void; getPosition: () => EditorPosition; setPosition: (position: EditorPosition) => void; foldRegions?: () => void | Promise; foldLines?: (linesToFold: Array<{ from: number; to: number; }>) => void | Promise; layout?: () => void; addTypes?: (lib: EditorLibrary, force?: boolean) => any; onContentChanged: (callback: () => void) => void; addKeyBinding: (label: string, keybinding: any, callback: () => void) => void; keyCodes: { CtrlEnter: any; ShiftEnter: any; Enter: any; UpArrow: any; DownArrow: any; ShiftAltF: any; }; changeSettings: (editorSettings: EditorConfig) => void; configureTailwindcss?: (enabled: boolean) => void; registerFormatter: (formatFn: FormatFn | undefined) => void; format: () => Promise; isReadonly: boolean; setTheme: (theme: Theme, editorTheme: Config['editorTheme']) => void; undo: () => void; redo: () => void; destroy: () => void; monaco?: any; codemirror?: any; prism?: any; codejar?: any; isFake?: boolean; } export interface EditorOptions extends EditorConfig { baseUrl: string; container: HTMLElement | null; language: Language; value: string; mode?: Config['mode']; readonly: boolean; editorId: EditorId | 'compiled' | 'console' | 'customSettings' | 'editorSettings' | 'codeToImage' | 'tests' | 'embed' | 'snippet' | 'add-snippet'; theme: Theme; isEmbed: boolean; isLite: boolean; isHeadless: boolean; getLanguageExtension: (alias: string) => Language | undefined; mapLanguage: (language: Language) => Language; getFormatterConfig: () => Partial; getFontFamily: (font: string | undefined) => string; } export type MonacoTheme = 'active4d' | 'all-hallows-eve' | 'amy' | 'birds-of-paradise' | 'blackboard' | 'brilliance-black' | 'brilliance-dull' | 'catppuccin-latte' | 'catppuccin-frappe' | 'catppuccin-macchiato' | 'catppuccin-mocha' | 'chrome-devtools' | 'clouds-midnight' | 'clouds' | 'cobalt' | 'cobalt2' | 'custom-vs-light' | 'custom-vs-dark' | 'dawn' | 'dracula' | 'dreamweaver' | 'eiffel' | 'espresso-libre' | 'github' | 'github-dark' | 'github-light' | 'hc-black' | 'hc-light' | 'idle' | 'idlefingers' | 'iplastic' | 'katzenmilch' | 'krtheme' | 'kuroir' | 'lazy' | 'magicwb-amiga' | 'merbivore-soft' | 'merbivore' | 'monochrome' | 'monochrome-dark' | 'monokai' | 'monokai-bright' | 'monoindustrial' | 'night-owl' | 'nord' | 'oceanic-next' | 'pastels-on-dark' | 'slush-and-poppies' | 'solarized-dark' | 'solarized-light' | 'spacecadet' | 'sunburst' | 'textmate-mac-classic' | 'tomorrow' | 'tomorrow-night' | 'tomorrow-night-blue' | 'tomorrow-night-bright' | 'tomorrow-night-eighties' | 'twilight' | 'upstream-sunburst' | 'vibrant-ink' | 'vs' | 'vs-dark' | 'xcode-default' | 'zenburnesque'; export type CodemirrorTheme = 'amy' | 'aura' | 'ayu-light' | 'barf' | 'basic-light' | 'basic-dark' | 'bespin' | 'birds-of-paradise' | 'boys-and-girls' | 'catppuccin-latte' | 'catppuccin-frappe' | 'catppuccin-macchiato' | 'catppuccin-mocha' | 'clouds' | 'cm-light' | 'cobalt' | 'cool-glow' | 'dracula' | 'espresso' | 'github-dark' | 'github-light' | 'gruvbox-dark' | 'gruvbox-light' | 'material-dark' | 'material-light' | 'monochrome' | 'monochrome-dark' | 'noctis-lilac' | 'nord' | 'one-dark' | 'rose-pine-dawn' | 'smoothy' | 'solarized-light' | 'solarized-dark' | 'tokyo-night' | 'tokyo-night-day' | 'tokyo-night-storm' | 'tomorrow'; export type CodejarTheme = 'a11y-dark' | 'atom-dark' | 'base16-ateliersulphurpool-light' | 'catppuccin-latte' | 'catppuccin-frappe' | 'catppuccin-macchiato' | 'catppuccin-mocha' | 'cb' | 'coldark-cold' | 'coldark-dark' | 'coy' | 'coy-without-shadows' | 'darcula' | 'dark' | 'dracula' | 'duotone-dark' | 'duotone-earth' | 'duotone-forest' | 'duotone-light' | 'duotone-sea' | 'duotone-space' | 'funky' | 'ghcolors' | 'gruvbox-dark' | 'gruvbox-light' | 'holi-theme' | 'hopscotch' | 'laserwave' | 'lucario' | 'material-dark' | 'material-light' | 'material-oceanic' | 'monochrome' | 'monochrome-dark' | 'night-owl' | 'nord' | 'nord-2' | 'okaidia' | 'one-dark' | 'one-light' | 'pojoaque' | 'shades-of-purple' | 'solarized-dark-atom' | 'solarized-light' | 'synthwave84' | 'tomorrow' | 'twilight' | 'vs' | 'vsc-dark-plus' | 'xonokai' | 'z-touchs'; export type EditorTheme = MonacoTheme | CodemirrorTheme | CodejarTheme | `${MonacoTheme}@${Theme}` | `${CodemirrorTheme}@${Theme}` | `${CodejarTheme}@${Theme}` | `monaco:${MonacoTheme}` | `codemirror:${CodemirrorTheme}` | `codejar:${CodejarTheme}` | `monaco:${MonacoTheme}@${Theme}` | `codemirror:${CodemirrorTheme}@${Theme}` | `codejar:${CodejarTheme}@${Theme}`; export interface CustomEditor { language: Language; show: (show: boolean, options: CustomEditorOptions) => Promise; getContent: (options: CustomEditorOptions) => Promise; setTheme: (theme: Theme) => void; } export interface CustomEditorOptions { baseUrl: string; editors: Editors; config: Config; html: string; eventsManager: EventsManager; } export type CustomEditors = { [key in Language]?: CustomEditor; }; export interface BlocklyContent { xml?: string; js?: string; } export type AppLanguage = 'auto' | 'ar' | 'de' | 'en' | 'es' | 'fr' | 'hi' | 'it' | 'ja' | 'pt' | 'ru' | 'ur' | 'zh-CN'; export interface User { uid: string; token: string | null; displayName: string | null; username: string | null; email: string | null; photoURL: string | null; } export type GithubScope = 'gist' | 'repo' | 'public_repo'; export interface ShareData { url: string; title: string; } export interface Screen { screen: 'login' | 'info' | 'new' | 'open' | 'assets' | 'add-asset' | 'snippets' | 'add-snippet' | 'import' | 'resources' | 'share' | 'embed' | 'deploy' | 'sync' | 'backup' | 'broadcast' | 'welcome' | 'about' | 'custom-settings' | 'editor-settings' | 'code-to-image' | 'test-editor' | 'keyboard-shortcuts'; show: (options?: any) => void | Promise; } export type CustomSettings = Partial<{ [key in Language | Processor]: any; } & { template: { data?: any; prerender?: boolean; }; scriptType: 'module' | 'application/javascript' | 'application/ecmascript' | 'text/javascript' | 'text/ecmascript' | '' | Compiler['scriptType']; mapImports: boolean; imports: Record; convertCommonjs: boolean; defaultCDN: CDN; types: Types; }>; export type CDN = 'jspm' | 'skypack' | 'jsdelivr' | 'fastly.jsdelivr' | 'gcore.jsdelivr' | 'testingcf.jsdelivr' | 'jsdelivr.b-cdn' | 'jsdelivr.gh' | 'fastly.jsdelivr.gh' | 'gcore.jsdelivr.gh' | 'testingcf.jsdelivr.gh' | 'jsdelivr.b-cdn.gh' | 'jsdelivr.esm' | 'fastly.jsdelivr.esm' | 'gcore.jsdelivr.esm' | 'testingcf.jsdelivr.esm' | 'jsdelivr.b-cdn.esm' | 'esm.run' | 'esm.sh' | 'esbuild' | 'bundle.run' | 'unpkg' | 'npmcdn' | 'statically'; export type EditorCache = Editor & { compiled: string; modified?: string; }; export type Cache = ContentConfig & { markup: EditorCache; style: EditorCache; script: EditorCache; tests?: EditorCache; result?: string; styleOnlyUpdate?: boolean; }; /** * An object that contains the language, content and compiled code for each of the 3 [code editors](https://livecodes.io/docs/features/projects) * and the [result page](https://livecodes.io/docs/features/result) HTML. * * See [docs](https://livecodes.io/docs/api/interfaces/Code) for details. */ export interface Code { markup: { language: Language; content: string; compiled: string; }; style: { language: Language; content: string; compiled: string; }; script: { language: Language; content: string; compiled: string; }; result: string; } export type Theme = 'light' | 'dark'; export type Await = T extends PromiseLike ? U : T; export type FileType = 'image' | 'audio' | 'video' | 'archive' | 'html' | 'stylesheet' | 'script' | 'font' | 'icon' | 'json' | 'csv' | 'xml' | 'text' | 'other'; export interface Asset { id: string; filename: string; type: FileType; url: string; lastModified: number; } export interface Snippet { id: string; title: string; description: string; language: Language; code: string; lastModified: number; } export interface EventsManager { addEventListener: (element: HTMLElement | Document | Window | FileReader | null, eventType: string, fn: (event: T) => any, _options?: any) => void; removeEventListener: (element: HTMLElement | Document | Window | FileReader | null, eventType: string, fn: (event: T) => any) => void; removeEventListeners: () => void; } export interface TestResult { duration: number; errors: string[]; status: 'pass' | 'fail' | 'skip'; testPath: string[]; } export interface Subscribable { subscribe: (fn: (data: T) => void) => { unsubscribe: () => void; }; unsubscribeAll: () => void; } export type languageSelector = `${Language}-selector`; export type ToolNames = `${Tool['name']}` | `${Tool['name']},${Tool['name']}` | `${Tool['name']},${Tool['name']},${Tool['name']}`; export type ToolsStatus = `${ToolNames}|${Config['tools']['status']}`; export type UrlQueryParams = Partial & Pick & { new: ''; } & { [key in Language]: string; } & { [key in languageSelector]: string; } & { sdkVersion: string; config: string; embed: boolean; preview: boolean; lite: boolean; x: string; files: string; raw: Language; language: Language; lang: Language; languages: string; processors: string; stylesheets: string; scripts: string; activeEditor: EditorId | 0 | 1 | 2; active: EditorId | 0 | 1 | 2; tags: string | string[]; 'no-defaults': boolean; scrollPosition: boolean; disableAI: boolean; tools: 'open' | 'full' | 'closed' | 'console' | 'compiled' | 'tests' | 'none' | ToolsStatus; } & { [key in Tool['name']]: 'open' | 'full' | 'closed' | 'none' | '' | 'true'; }>; export interface CustomEvents { init: 'livecodes-init'; /** @deprecated config is sent in hash params */ getConfig: 'livecodes-get-config'; /** @deprecated config is sent in hash params */ config: 'livecodes-config'; load: 'livecodes-load'; appLoaded: 'livecodes-app-loaded'; ready: 'livecodes-ready'; change: 'livecodes-change'; testResults: 'livecodes-test-results'; console: 'livecodes-console'; destroy: 'livecodes-destroy'; resizeEditor: 'livecodes-resize-editor'; apiResponse: 'livecodes-api-response'; i18n: 'livecodes-i18n'; } export interface PkgInfo { name: string; description?: string; version?: string; repository?: { url?: string; }; repo?: string; homepage?: string; } export interface APIError { error: boolean; status?: number; message?: string; } export interface CDNService { search: (query: string, limit?: number) => Promise; getPkgInfo: (pkgName: string) => Promise; getPkgFiles: (pkgName: string) => Promise<{ default?: string; files: string[]; } | APIError>; getPkgDefaultFiles: (pkgName: string) => Promise<{ js?: string; css?: string; } | APIError>; } export interface WorkerMessageEvent extends MessageEvent { data: { messageId: string; method: T; args?: any; data?: K; }; } } declare module "livecodes/models" { export type * from "sdk/models"; export interface ModalOptions { size?: 'large' | 'small' | 'full'; closeButton?: boolean; isAsync?: boolean; onClose?: () => void; scrollToSelector?: string; autoFocus?: boolean; } export interface Modal { show: (container: HTMLElement, options?: ModalOptions) => void; close: () => void; } export interface Notifications { info: (message: string, dismissable?: boolean) => void; success: (message: string, dismissable?: boolean) => void; warning: (message: string, dismissable?: boolean) => void; error: (message: string, dismissable?: boolean) => void; confirm: (message: string, confirmCallback: () => void, cancelCallback?: () => void) => void; } export interface INinjaAction { title: string; keywords?: string; content?: string; id?: string; hotkey?: string; icon?: string; mdIcon?: string; parent?: string; children?: string[] | Array>; section?: string; href?: string; attributes?: Record; handler?: (action: INinjaAction, event: KeyboardEvent | CustomEvent | undefined, searchQuery: string) => void | { keepOpen: boolean; } | Promise; matcher?: (action: INinjaAction, searchOptions: { searchString: string; searchRegex: RegExp; }) => boolean; keepOpen?: boolean; } } declare module "livecodes/utils/utils" { import type { Config, Language, Processor } from "livecodes/models"; export const debounce: (fn: (...x: any[]) => any, delay: number | (() => number)) => (...args: unknown[]) => void; export const decodeHTML: (html: string) => string; export const encodeHTML: (html: string) => string; export const escapeScript: (code: string) => string; export const escapeCode: (code: string, slash?: boolean) => string; export const pipe: (...fns: Function[]) => Function; export const safeName: (name: string, symbol?: string) => string; export const isMobile: () => boolean; export const isMac: () => boolean; export const ctrl: (e: KeyboardEvent) => boolean; export const isFirefox: () => boolean; export const isRelativeUrl: (url?: string) => boolean; export const getAbsoluteUrl: (url: string, baseUrl?: string) => string; export const cloneObject: (x: Record) => T; export const objectMap: (obj: Record, fn: (value: any, key: string, index: number) => any) => { [k: string]: any; }; export const objectFilter: (obj: Record, predicate: (value: any, key: string, index: number) => any) => { [k: string]: any; }; export const copyToClipboard: (text: string) => boolean | Promise; export const copyImage: (image: Blob, type: 'png' | 'jpg' | 'svg') => Promise; export const stringToValidJson: (str: string) => string; export const stringify: (obj: any, pretty?: boolean) => string; export const getRandomString: () => string; export const downloadFile: (filename: string, extension: string, content: string) => void; export const loadScript: (url: string, name?: string) => Promise; export const loadStylesheet: (url: string, id?: string, insertBefore?: string) => void; export const typedArrayToBuffer: (array: Uint8Array) => ArrayBuffer; export const getDate: () => string; export const handleFetchError: (res: Response) => Response | Promise; export const fetchWithHandler: (input: RequestInfo, init?: RequestInit) => Promise; export const blobToBase64: (file: Blob) => Promise; export const Uint8ArrayToBase64: (u8: Uint8Array) => string; export const base64ToUint8Array: (str: string) => Uint8Array; export const typedArraysAreEqual: (a: Uint8Array, b: Uint8Array) => boolean; export const toDataUrl: (content: string, type?: string) => string; export const getWorkerDataURL: (url: string) => string; export const createWorkerFromContent: (content: string) => Worker; export const removeComments: (src: string) => string; export const removeStrings: (src: string) => string; export const removeCommentsAndStrings: (src: string) => string; export const getLanguageCustomSettings: (language: Language | Processor, config: Config) => any; export const getValidUrl: (url?: string) => string | null; export const runOrContinue: (fn: (x: T) => Promise, catchFn?: (err: unknown) => void) => (x: T) => Promise; export const getFileExtension: (file: string) => string; export const isInIframe: () => boolean; export const indentCode: (code: string, spaces: number, skipFirstLine?: boolean) => string; export const hideOnClickOutside: (element: HTMLElement) => { clear: () => void; }; export const callWorker: (worker: Worker, message: { method: T; args?: any; }) => Promise; export const capitalize: (str: string) => string; export const toCamelCase: (str: string) => string; export const removeDuplicates: (arr: any[] | undefined) => any[]; export const replaceAsync: (str: string, regexp: RegExp, asyncFn: (...args: any) => Promise) => Promise; export const addAttrs: (el: HTMLElement, attributes: Record | string) => void; /** * Bypasses the AMD module definition system by temporarily disabling it while executing the given function. * * @param fn - The function to execute. * @return The result of executing the function. */ export const bypassAMD: (fn: () => Promise) => Promise; /** * Returns an async function that ensures the given asynchronous function is executed only once and awaits the previous executions. * * @param {() => Promise} fn - The asynchronous function to be executed once. * @return {() => Promise} An async function that, when called multiple times, executes the given function if it hasn't been executed before or awaits the previous execution. */ export const doOnce: (fn: () => Promise) => () => Promise; export const evaluateCssCalc: (expression: string) => string; export const colorToRgba: (name: string) => { r: number; g: number; b: number; a: number; }; export const colorToHsla: (color: string) => { h: number; s: number; l: number; a: number; }; export const colorToHex: (color: string) => string; type ValueOf = T[keyof T]; type NonEmptyArray = [T, ...T[]]; type MustInclude = [T] extends [ValueOf] ? U : never; /** * converts TypeScript string union to array * see https://stackoverflow.com/a/70694878/5054774 */ export const stringUnionToArray: () => >(...elements: MustInclude) => MustInclude; export const preventFocus: (container: HTMLElement) => void; export const findFirstFocusableElement: (container: HTMLElement) => Element | undefined; export const isFocusable: (item: any | null) => boolean; /** * Compares two objects and returns a list of keys of source object * whose values are different from the destination object. */ export const compareObjects: (srcObj: Record, dstObj: Record) => string[]; export const predefinedValues: { readonly APP_VERSION: string; readonly SDK_VERSION: string; readonly COMMIT_SHA: string; readonly REPO_URL: string; readonly DOCS_BASE_URL: string; }; } declare module "livecodes/html/index" { const resultTemplate: string; const appHTML: string; const menuProjectHTML: string; const menuSettingsHTML: string; const menuHelpHTML: string; const languageInfo: string; const customSettingsScreen: string; const testEditorScreen: string; const importScreen: string; const deployScreen: string; const syncScreen: string; const backupScreen: string; const broadcastScreen: string; const welcomeScreen: string; const aboutScreen: string; const infoScreen: string; const resourcesScreen: string; const keyboardShortcutsScreen: string; const loginScreen: string; const savePromptScreen: string; const recoverPromptScreen: string; const templatesScreen: string; const openScreen: string; const assetsScreen: string; const addAssetScreen: string; const snippetsScreen: string; const addSnippetScreen: string; const shareScreen: string; const embedScreen: string; const editorSettingsScreen: string; const codeToImageScreen: string; const resultPopupHTML: string; export { aboutScreen, addAssetScreen, addSnippetScreen, appHTML, assetsScreen, backupScreen, broadcastScreen, codeToImageScreen, customSettingsScreen, deployScreen, editorSettingsScreen, embedScreen, importScreen, infoScreen, keyboardShortcutsScreen, languageInfo, loginScreen, menuHelpHTML, menuProjectHTML, menuSettingsHTML, openScreen, recoverPromptScreen, resourcesScreen, resultPopupHTML, resultTemplate, savePromptScreen, shareScreen, snippetsScreen, syncScreen, templatesScreen, testEditorScreen, welcomeScreen, }; } declare module "livecodes/utils/compression" { export const compress: (uncompressed: string) => string; export const decompress: (compressed: string, isJSON?: boolean) => string | null; } declare module "livecodes/sync/diff" { import * as DeepDiff from 'deep-diff'; import * as Y from 'yjs'; export { DeepDiff, Y }; export function toJSON(source: unknown): T; export function applyChange(target: any, change: DeepDiff.Diff): void; } declare module "livecodes/sync/models" { import type { WorkerMessageEvent } from "livecodes/models"; export type SyncMethod = 'sync' | 'exportToLocalSync' | 'exportStoreAsBase64Update' | 'restoreFromUpdate' | 'restoreFromLocalSync'; export type SyncMessageEvent = WorkerMessageEvent; export interface StoredSyncData { lastModified: number; data: Uint8Array; lastSyncSha: string; } } declare module "livecodes/services/modules" { import type { CDN } from "livecodes/models"; export const modulesService: { getModuleUrl: (moduleName: string, { isModule, defaultCDN, external, }?: { isModule?: boolean; defaultCDN?: CDN; external?: string; }) => string; getUrl: (path: string, cdn?: CDN) => string; cdnLists: { npm: CDN[]; module: CDN[]; gh: CDN[]; }; checkCDNs: (testModule: string, preferredCDN?: CDN) => Promise; }; export const getAppCDN: () => CDN; } declare module "livecodes/services/github" { import type { User } from "livecodes/models"; export interface GitHubFile { path: string; content: string; } export const getGithubHeaders: (user: User, mediaType?: 'object' | 'raw') => { Accept: string; 'Content-Type': string; Authorization: string; }; export const repoExists: (user: User, repo: string) => Promise; export const getContent: ({ user, repo, branch, path, }: { user: User; repo: string; branch?: string; path: string; }) => Promise; export const commitFiles: ({ files, user, repo, branch, message, newRepo, privateRepo, description, readmeContent, clearPrevious, }: { files: GitHubFile[]; user: User; repo: string; branch: string; message: string; newRepo?: boolean; privateRepo?: boolean; description?: string; readmeContent?: string; clearPrevious?: boolean; }) => Promise<{ tree: string; commit: string; } | null>; export const commitFile: ({ file, user, repo, branch, message, newRepo, privateRepo, description, readmeContent, }: { file: GitHubFile; user: User; repo: string; branch: string; message: string; newRepo?: boolean; privateRepo?: boolean; description?: string; readmeContent?: string; }) => Promise<{ tree: any; commit: any; } | null>; export const getUserRepos: (user: User, reposType?: 'all' | 'owner' | 'public' | 'private' | 'member') => Promise; } declare module "livecodes/events/custom-events" { import type { CustomEvents } from "livecodes/models"; export const customEvents: CustomEvents; } declare module "livecodes/events/events" { import type { EventsManager } from "livecodes/models"; export const createEventsManager: () => EventsManager; } declare module "livecodes/events/pub" { export const createPub: () => { subscribe: (fn: (data: T) => void) => { unsubscribe: () => void; }; notify: (data: T) => void; hasSubscribers: () => boolean; unsubscribeAll: () => void; }; } declare module "livecodes/events/index" { export * from "livecodes/events/custom-events"; export * from "livecodes/events/events"; export * from "livecodes/events/pub"; } declare module "livecodes/vendors" { export const vendorsBaseUrl: string; export const acornUrl: string; export const artTemplateUrl: string; export const asciidocUrl: string; export const assemblyscriptLoaderUrl: string; export const astringUrl: string; export const astroBaseUrl: string; export const astroWasmURL: string; export const autoCompleteUrl: string; export const babelUrl: string; export const biwaschemeUrl: string; export const blocklyCdnBaseUrl: string; export const browserfsUrl: string; export const browserJestUrl: string; export const brythonBaseUrl: string; export const chaiUrl: string; export const cherryCljsBaseUrl: string; export const cjs2esUrl: string; export const clioBaseUrl: string; export const cm6ThemeBasicLightUrl: string; export const cm6ThemeBasicDarkUrl: string; export const cm6ThemeGruvboxLightUrl: string; export const cm6ThemeGruvboxDarkUrl: string; export const cm6ThemeMaterialDarkUrl: string; export const cm6ThemeNordUrl: string; export const cm6ThemeSolarizedLightUrl: string; export const cm6ThemeSolarizedDarkUrl: string; export const codeiumProviderUrl: string; export const codeMirrorBaseUrl: string; export const coffeeScriptUrl: string; export const colorisBaseUrl: string; export const comlinkBaseUrl: string; export const cppWasmBaseUrl: string; export const csharpWasmBaseUrl: string; export const csstreeUrl: string; export const cytoscapeSvgUrl: string; export const cytoscapeUrl: string; export const ddietrCmThemesBaseUrl: string; export const doppioJvmBaseUrl = "https://unpkg.com/@seth0x41/doppio@1.0.0/"; export const dotUrl: string; export const ejsUrl: string; export const elkjsBaseUrl: string; export const emmetMonacoUrl: string; export const esModuleShimsPath = "es-module-shims@1.10.0/dist/es-module-shims.js"; export const etaUrl: string; export const fflateUrl: string; export const flexSearchUrl: string; export const fontAnonymousProUrl: string; export const fontAstigmataUrl: string; export const fontAwesomeUrl: string; export const fontCascadiaCodeUrl: string; export const fontCodeNewRomanUrl: string; export const fontComicMonoUrl: string; export const fontCourierPrimeUrl: string; export const fontDECTerminalModernUrl: string; export const fontDejaVuMonoUrl: string; export const fontFantasqueUrl: string; export const fontFiraCodeUrl: string; export const fontFixedsysUrl: string; export const fontHackUrl: string; export const fontHermitUrl: string; export const fontIBMPlexMonoUrl: string; export const fontInconsolataUrl: string; export const fontInterUrl: string; export const fontIosevkaUrl: string; export const fontJetbrainsMonoUrl: string; export const fontMaterialIconsUrl: string; export const fontMenloUrl: string; export const fontMonaspaceBaseUrl: string; export const fontMonofurUrl: string; export const fontMonoidUrl: string; export const fontNotoUrl: string; export const fontNovaMonoUrl: string; export const fontOpenDyslexicUrl: string; export const fontProFontWindowsUrl: string; export const fontRobotoMonoUrl: string; export const fontSFMonoUrl: string; export const fontSourceCodeProUrl: string; export const fontSpaceMonoUrl: string; export const fontSudoVarUrl: string; export const fontUbuntuMonoUrl: string; export const fontVictorMonoUrl: string; export const fscreenUrl: string; export const githubMarkdownCss: string; export const gleamBaseUrl: string; export const go2jsBaseUrl: string; export const graphreCdnUrl: string; export const handlebarsBaseUrl: string; export const highlightjsUrl: string; export const hpccJsCdnUrl: string; export const htmlToImageUrl: string; export const imbaBaseUrl: string; export const jestTypesUrl: string; export const jsclUrl: string; export const jsZipUrl: string; export const juliaWasmBaseUrl: string; export const liquidJsUrl: string; export const localforageUrl: string; export const luaUrl: string; export const lunaConsoleStylesUrl: string; export const lunaDataGridStylesUrl: string; export const lunaDomViewerStylesUrl: string; export const lunaObjViewerStylesUrl: string; export const malinaBaseUrl: string; export const markedUrl: string; export const mermaidCdnUrl: string; export const mjmlUrl: string; export const monacoBaseUrl: string; export const monacoEmacsUrl: string; export const monacoThemesBaseUrl: string; export const monacoVimUrl: string; export const monacoVolarUrl: string; export const mustacheUrl: string; export const ninjaKeysUrl: string; export const nomnomlCdnUrl: string; export const normalizeCssUrl: string; export const nunjucksBaseUrl: string; export const opalBaseUrl: string; export const parinferUrl: string; export const pathBrowserifyUrl: string; export const pgliteUrl: string; export const pintoraUrl: string; export const plotlyCdnUrl: string; export const postcssImportUrlUrl: string; export const prettierBaseUrl: string; export const prettierPhpUrl: string; export const prismBaseUrl: string; export const prismOfficialThemesBaseUrl: string; export const prismThemesBaseUrl: string; export const prismThemeNordUrl: string; export const prismThemesLaserWaveUrl: string; export const pyodideBaseUrl: string; export const qrcodeUrl: string; export const quillEditorCdnBaseUrl: string; export const quillHtmlEditUrl: string; export const quillBlotFormatterUrl: string; export const quillBetterTableBaseUrl: string; export const requireUrl: string; export const reasonCompilerUrl: string; export const reasonReactUrl: string; export const reasonStdLibBaseUrl: string; export const rescriptCdnBaseUrl: string; export const rescriptStdLibBaseUrl: string; export const resetCssUrl: string; export const riotBaseUrl: string; export const rubyWasmBaseUrl: string; export const rubyWasmScriptUrl: string; export const snackbarUrl: string; export const spacingJsUrl: string; export const sqlFormatterUrl: string; export const sqljsBaseUrl: string; export const squintCljsBaseUrl: string; export const stencilUrl: string; export const stylisUrl: string; export const svelteBaseUrl: string; export const svgbobWasmCdnUrl: string; export const tagifyBaseUrl: string; export const tailwindcssBaseUrl: string; export const tailwindcss3Url: string; export const tauPrologBaseUrl: string; export const tealUrl: string; export const thememirrorBaseUrl: string; export const twigUrl: string; export const typescriptUrl: string; export const typescriptVfsUrl: string; export const uniterUrl: string; export const vegaCdnUrl: string; export const vegaLiteCdnUrl: string; export const vue3CdnUrl: string; export const vue2CdnUrl: string; export const vueRuntimeUrl: string; export const vueSDKUrl: string; export const vueSfcLoaderCdnBaseUrl: string; export const wabtjsUrl: string; export const wasmoonUrl: string; export const waveDromBaseUrl: string; export const webRBaseUrl: string; } declare module "livecodes/storage/fake-storage" { import type { SimpleStorage, Storage } from "livecodes/storage/models"; export const fakeStorage: Omit, 'getList'> & { getList: () => Promise<[]>; }; export const fakeSimpleStorage: SimpleStorage; } declare module "livecodes/storage/storage" { import type { Storage, StoreName } from "livecodes/storage/models"; export const generateId: () => string; /** * Creates asynchronous data store using localforage */ export const createStorage: (name: StoreName, isEmbed: boolean) => Promise>; } declare module "livecodes/storage/project-storage" { import type { ProjectStorage, StoreName } from "livecodes/storage/models"; export const createProjectStorage: (name: StoreName, isEmbed: boolean) => Promise; } declare module "livecodes/storage/simple-storage" { import type { SimpleStorage, StoreName } from "livecodes/storage/models"; /** * Creates a simple synchronous key/value data store using localstorage */ export const createSimpleStorage: (name: StoreName, isEmbed: boolean) => SimpleStorage; } declare module "livecodes/storage/stores" { import type { ProjectStorage, SimpleStorage, Storage, Stores } from "livecodes/storage/models"; export const createStores: () => Stores; export const initializeStores: (stores: Stores, isEmbed: boolean) => Promise; export const initializeSimpleStores: (stores: Stores, isEmbed: boolean) => Promise; export const getStoreKey: (store: SimpleStorage | Storage | ProjectStorage, stores: Stores) => string | null; } declare module "livecodes/sync/sync.worker" { import type { User } from "livecodes/models"; import type { Stores } from "livecodes/storage/index"; const sync: ({ user, repo, branch, newRepo, }: { user: User; repo: string; branch?: string; newRepo: boolean; }) => Promise; const exportToLocalSync: ({ user, storeKey }: { user: User; storeKey: keyof Stores; }) => Promise; const exportStoreAsBase64Update: ({ storeKey }: { storeKey: keyof Stores; }) => Promise; const restoreFromUpdate: ({ update, storeKey, mergeCurrent, }: { update: Uint8Array; storeKey: keyof Stores; mergeCurrent?: boolean; }) => Promise; const restoreFromLocalSync: ({ user, storeKey, mergeCurrent, }: { user: User; storeKey: keyof Stores; mergeCurrent?: boolean; }) => Promise; export type workerSync = typeof sync; export type workerExportToLocalSync = typeof exportToLocalSync; export type workerExportStoreAsBase64Update = typeof exportStoreAsBase64Update; export type workerRestoreFromUpdate = typeof restoreFromUpdate; export type workerRestoreFromLocalSync = typeof restoreFromLocalSync; } declare module "livecodes/sync/sync" { import type { workerExportStoreAsBase64Update, workerExportToLocalSync, workerRestoreFromLocalSync, workerRestoreFromUpdate, workerSync } from "livecodes/sync/sync.worker"; export const init: (baseUrl: string) => void; export const sync: workerSync; export const exportToLocalSync: workerExportToLocalSync; export const exportStoreAsBase64Update: workerExportStoreAsBase64Update; export const restoreFromUpdate: workerRestoreFromUpdate; export const restoreFromLocalSync: workerRestoreFromLocalSync; } declare module "livecodes/sync/index" { export * from "livecodes/sync/diff"; export type * from "livecodes/sync/models"; export * from "livecodes/sync/sync"; } declare module "livecodes/storage/models" { import type { AppData, Asset, ContentConfig, Language, Snippet, Subscribable, UserConfig, UserData } from "livecodes/models"; import type { StoredSyncData } from "livecodes/sync/index"; export interface Storage extends Subscribable { getList: () => Promise; getAllData: () => Promise; getItem: (id: string) => Promise; addItem: (item: T) => Promise; updateItem: (id: string, item: T) => Promise; deleteItem: (id: string) => Promise; bulkInsert: (data: T[]) => Promise; restore: (data: T[]) => Promise; clear: () => Promise; } export interface ProjectStorage extends Omit, 'getList' | 'addItem' | 'updateItem' | 'bulkInsert'> { getList: () => Promise; addItem: (config: ContentConfig) => Promise; updateItem: (id: string, config: ContentConfig) => Promise; deleteItem: (id: string) => Promise; bulkInsert: (newProjects: ContentConfig[]) => Promise; } export interface StorageItem { id: string; config: ContentConfig; lastModified: number; } export interface RecoverItem { config: ContentConfig; lastModified: number; } export interface SavedProject { id: string; title: string; description: string; tags: string[]; languages: Language[]; lastModified: number; } export interface SimpleStorage extends Subscribable { getValue: () => T | null; setValue: (value: T | null) => void; clear: () => void; } export interface Stores { projects: ProjectStorage | undefined; templates: ProjectStorage | undefined; assets: Storage | undefined; snippets: Storage | undefined; recover: SimpleStorage | undefined; userConfig: SimpleStorage | undefined; userData: Storage> | undefined; appData: SimpleStorage | undefined; sync: Storage | undefined; } export type StorageData = { [key in keyof Stores]: any | undefined; }; export type StoreName = '__livecodes_data__' | '__livecodes_templates__' | '__livecodes_assets__' | '__livecodes_snippets__' | '__livecodes_project_recover__' | '__livecodes_user_config__' | '__livecodes_user_data__' | '__livecodes_app_data__' | '__livecodes_sync_data__' | '__livecodes_key__'; } declare module "livecodes/storage/encrypt" { export const encrypt: (text: string) => Promise; export const decrypt: (encrypted: string) => Promise; } declare module "livecodes/storage/index" { export * from "livecodes/storage/encrypt"; export * from "livecodes/storage/fake-storage"; export type { ProjectStorage, RecoverItem, SavedProject, SimpleStorage, Storage, StorageData, StorageItem, StoreName, Stores, } from "livecodes/storage/models"; export * from "livecodes/storage/project-storage"; export * from "livecodes/storage/simple-storage"; export * from "livecodes/storage/storage"; export * from "livecodes/storage/stores"; } declare module "livecodes/UI/info" { import type { Config, Modal } from "livecodes/models"; import type { ProjectStorage } from "livecodes/storage/index"; export const getTags: (value: string) => string[]; export const createProjectInfoUI: (config: Config, storage: ProjectStorage, modal: Modal, onUpdate: (title: string, description: string, head: string, htmlAttrs: string, tags: string[]) => void) => Promise; } declare module "livecodes/UI/loading" { export const loadingMessage: (message?: string) => HTMLDivElement; } declare module "livecodes/UI/selectors" { export const getToolbarElement: () => HTMLElement; export const getProjectTitleElement: () => HTMLElement; export const getEditorContainerElement: () => HTMLElement; export const getEditorsElement: () => HTMLElement; export const getMarkupElement: () => HTMLElement; export const getStyleElement: () => HTMLElement; export const getScriptElement: () => HTMLElement; export const getOutputElement: () => HTMLElement; export const getResultElement: () => HTMLElement; export const getResultIFrameElement: () => HTMLIFrameElement; export const getGutterElement: () => HTMLElement; export const getLogoLink: () => HTMLAnchorElement; export const getRunButton: () => HTMLElement; export const getLightThemeButton: () => HTMLElement; export const getDarkThemeButton: () => HTMLElement; export const getI18nMenuButton: () => HTMLElement; export const getI18nMenuContainer: () => HTMLElement; export const getMarkupEditorTitle: () => HTMLElement; export const getStyleEditorTitle: () => HTMLElement; export const getScriptEditorTitle: () => HTMLElement; export const getEditorToolbar: () => HTMLElement; export const getFocusButton: () => HTMLElement; export const getCopyButton: () => HTMLElement; export const getCopyAsUrlButton: () => HTMLElement; export const getCodeToImageButton: () => HTMLElement; export const getUndoButton: () => HTMLElement; export const getRedoButton: () => HTMLElement; export const getFormatButton: () => HTMLElement; export const getEditorModeNode: () => HTMLElement | null; export const getEditorStatus: () => HTMLElement; export const getExternalResourcesBtn: () => HTMLElement; export const getExternalResourcesMark: () => HTMLElement; export const getProjectInfoBtn: () => HTMLElement; export const getCustomSettingsBtn: () => HTMLElement; export const getEditorSettingsBtn: () => HTMLElement; export const getShareButton: () => HTMLElement; export const getResultButton: () => HTMLElement; export const getFullscreenButton: () => HTMLElement; export const getEditorTitles: () => NodeListOf; export const getEditorDivs: () => NodeListOf; export const getToolspaneElement: () => HTMLElement; export const getToolspaneBar: () => HTMLElement; export const getToolspaneButtons: () => HTMLElement; export const getToolspaneTitles: () => HTMLElement | null; export const getConsoleButton: () => HTMLElement | null; export const getCompiledButton: () => HTMLElement | null; export const getTestsButton: () => HTMLElement | null; export const getToolspaneLoader: () => HTMLElement | null; export const getZoomButton: () => HTMLElement | null; export const getZoomButtonValue: () => HTMLElement | null; export const getResultPopupButton: () => HTMLElement | null; export const getModalSaveButton: () => HTMLElement; export const getModalDoNotSaveButton: () => HTMLElement; export const getModalCancelButton: () => HTMLElement; export const getModalRecoverButton: () => HTMLElement; export const getModalSavePreviousButton: () => HTMLElement; export const getModalCancelRecoverButton: () => HTMLElement; export const getModalUnsavedName: () => HTMLElement; export const getModalUnsavedLastModified: () => HTMLElement; export const getModalDisableRecoverCheckbox: () => HTMLInputElement; export const getLanguageMenuLinks: () => NodeListOf; export const getLanguageMenuButtons: () => NodeListOf; export const getstyleMenu: () => HTMLElement | null; export const getSettingToggles: () => NodeListOf; export const getThemeColorSelector: () => HTMLElement | null; export const getCssPresetLinks: () => NodeListOf; export const getAppMenuProjectScroller: () => HTMLElement | null; export const getAppMenuProjectButton: () => HTMLElement | null; export const getAppMenuSettingsScroller: () => HTMLElement | null; export const getAppMenuSettingsButton: () => HTMLElement | null; export const getAppMenuHelpScroller: () => HTMLElement | null; export const getAppMenuHelpButton: () => HTMLElement | null; export const getExportJSONLink: () => HTMLAnchorElement | null; export const getExportResultLink: () => HTMLAnchorElement | null; export const getExportSourceLink: () => HTMLAnchorElement | null; export const getExportGithubGistLink: () => HTMLAnchorElement | null; export const getExportCodepenLink: () => HTMLAnchorElement | null; export const getExportJsfiddleLink: () => HTMLAnchorElement | null; export const getLoginLink: () => HTMLAnchorElement | null; export const getLogoutLink: () => HTMLAnchorElement | null; export const getNewLink: () => HTMLAnchorElement | null; export const getOpenLink: () => HTMLAnchorElement | null; export const getSaveLink: () => HTMLAnchorElement | null; export const getForkLink: () => HTMLAnchorElement | null; export const getSaveAsTemplateLink: () => HTMLAnchorElement | null; export const getExternalResourcesLink: () => HTMLAnchorElement | null; export const getCustomSettingsLink: () => HTMLAnchorElement | null; export const getShareLink: () => HTMLAnchorElement | null; export const getEmbedLink: () => HTMLAnchorElement | null; export const getEditorSettingsLink: () => HTMLAnchorElement | null; export const getDeployLink: () => HTMLAnchorElement | null; export const getSyncLink: () => HTMLAnchorElement | null; export const getSyncIndicator: () => HTMLAnchorElement | null; export const getImportLink: () => HTMLAnchorElement | null; export const getBackupLink: () => HTMLAnchorElement | null; export const getBroadcastLink: () => HTMLAnchorElement | null; export const getWelcomeLink: () => HTMLAnchorElement | null; export const getAboutLink: () => HTMLAnchorElement | null; export const getCommandMenuLink: () => HTMLAnchorElement | null; export const getKeyboardShortcutsMenuLink: () => HTMLAnchorElement | null; export const getAutoupdateToggle: () => HTMLInputElement; export const getDelayValue: () => HTMLElement; export const getDelayRange: () => HTMLInputElement; export const getAutosaveToggle: () => HTMLInputElement; export const getAutosyncToggle: () => HTMLInputElement; export const getFormatOnsaveToggle: () => HTMLInputElement; export const getProcessorToggles: () => NodeListOf; export const getEmmetToggle: () => HTMLInputElement; export const getThemeToggle: () => HTMLInputElement; export const getLayoutToggle: () => HTMLInputElement; export const getShowWelcomeToggle: () => HTMLInputElement; export const getRecoverToggle: () => HTMLInputElement; export const getThemeColorContainer: () => HTMLElement; export const getCustomThemeColorInput: () => HTMLInputElement; export const getSpacingToggle: () => HTMLInputElement; export const getCSSPresetLinks: () => NodeListOf; export const getProjectInfoLink: () => HTMLInputElement; export const getAssetsLink: () => HTMLInputElement; export const getSnippetsLink: () => HTMLInputElement; export const getHelpMenu: () => HTMLElement; export const getInfoTitleInput: () => HTMLInputElement; export const getInfoHead: () => HTMLTextAreaElement; export const getInfoHtmlAttrs: () => HTMLTextAreaElement; export const getInfoDescription: () => HTMLTextAreaElement; export const getInfoTagsInput: () => HTMLInputElement; export const getExternalResourcesTextareas: () => NodeListOf; export const getExternalResourcesCssPresetInputs: () => NodeListOf; export const getCustomSettingsEditor: () => HTMLElement | null; export const getLoadCustomSettingsButton: () => HTMLElement | null; export const getTestEditor: () => HTMLElement | null; export const getLoadTestsButton: () => HTMLElement | null; export const getEditTestsButton: () => HTMLElement | null; export const getRunTestsButton: () => HTMLElement | null; export const getWatchTestsButton: () => HTMLElement | null; export const getUrlImportForm: (importContainer: HTMLElement) => HTMLFormElement | null; export const getUrlImportButton: (importContainer: HTMLElement) => HTMLButtonElement; export const getUrlImportInput: (importContainer: HTMLElement) => HTMLInputElement; export const getCodeImportInput: (importContainer: HTMLElement) => HTMLInputElement; export const getImportJsonUrlForm: (importContainer: HTMLElement) => HTMLInputElement; export const getImportJsonUrlButton: (importContainer: HTMLElement) => HTMLInputElement; export const getImportJsonUrlInput: (importContainer: HTMLElement) => HTMLInputElement; export const getBulkImportJsonUrlForm: (importContainer: HTMLElement) => HTMLInputElement; export const getBulkImportJsonUrlButton: (importContainer: HTMLElement) => HTMLInputElement; export const getBulkImportJsonUrlInput: (importContainer: HTMLElement) => HTMLInputElement; export const getLinkToSavedProjects: (importContainer: HTMLElement) => HTMLAnchorElement; export const getImportFileInput: (importContainer: HTMLElement) => HTMLInputElement; export const getImportFileInputLabel: (importContainer: HTMLElement) => HTMLInputElement; export const getBulkImportFileInput: (importContainer: HTMLElement) => HTMLInputElement; export const getNewRepoForm: (deployContainer: HTMLElement) => HTMLFormElement | null; export const getNewRepoButton: (deployContainer: HTMLElement) => HTMLButtonElement; export const getNewRepoNameInput: (deployContainer: HTMLElement) => HTMLInputElement; export const getNewRepoNameError: (deployContainer: HTMLElement) => HTMLElement; export const getNewRepoMessageInput: (deployContainer: HTMLElement) => HTMLInputElement; export const getNewRepoCommitSource: (deployContainer: HTMLElement) => HTMLInputElement; export const getNewRepoAutoSync: (deployContainer: HTMLElement) => HTMLInputElement; export const getExistingRepoForm: (deployContainer: HTMLElement) => HTMLFormElement | null; export const getExistingRepoButton: (deployContainer: HTMLElement) => HTMLButtonElement; export const getExistingRepoNameInput: (deployContainer: HTMLElement) => HTMLInputElement; export const getExistingRepoMessageInput: (deployContainer: HTMLElement) => HTMLInputElement; export const getExistingRepoCommitSource: (deployContainer: HTMLElement) => HTMLInputElement; export const getExistingRepoAutoSync: (deployContainer: HTMLElement) => HTMLInputElement; export const getStarterTemplatesTab: (templatesContainer: HTMLElement) => HTMLElement | null; export const getStarterTemplatesList: (templatesContainer: HTMLElement) => HTMLElement | null; export const getUserTemplatesScreen: (templatesContainer: HTMLElement) => HTMLElement; export const getBulkImportButton: (listContainer: HTMLElement) => HTMLElement; export const getExportAllButton: (listContainer: HTMLElement) => HTMLElement; export const getDeleteAllButton: (listContainer: HTMLElement) => HTMLElement; export const getAddAssetButton: (listContainer: HTMLElement) => HTMLElement; export const getAssetsDeleteAllButton: (listContainer: HTMLElement) => HTMLElement; export const getAssetsButton: (listContainer: HTMLElement) => HTMLElement; export const getAssetDataUrlFileInput: (listContainer: HTMLElement) => HTMLInputElement; export const getAssetDataUrlOutput: (listContainer: HTMLElement) => HTMLElement; export const getAssetGHPagesFileInput: (listContainer: HTMLElement) => HTMLInputElement; export const getAssetGHPagesFileInputLabel: (listContainer: HTMLElement) => HTMLElement; export const getAssetGHPagesFileInputButton: (listContainer: HTMLElement) => HTMLElement; export const getAssetGHPagesOutput: (listContainer: HTMLElement) => HTMLElement; export const getSyncStatus: (syncContainer: HTMLElement | undefined) => HTMLElement | null; export const getStartSyncBtns: (syncContainer: HTMLElement | undefined) => NodeListOf; export const getBackupForm: (backupContainer: HTMLElement) => HTMLFormElement; export const getBackupBtn: (backupContainer: HTMLElement) => HTMLButtonElement; export const getBackupCheckedInputs: (backupContainer: HTMLElement) => NodeListOf; export const getAddSnippetButton: (snippetsContainer: HTMLElement) => HTMLElement; export const getSnippetsDeleteAllButton: (snippetsContainer: HTMLElement) => HTMLElement; export const getSnippetLanguageSelect: (snippetsContainer: HTMLElement) => HTMLSelectElement; export const getAddSnippetEditor: (snippetsContainer: HTMLElement) => HTMLElement; export const getSnippetTitleInput: (snippetsContainer: HTMLElement) => HTMLInputElement; export const getSnippetDescriptionArea: (snippetsContainer: HTMLElement) => HTMLTextAreaElement; export const getSaveSnippetBtn: (snippetsContainer: HTMLElement) => HTMLButtonElement; export const getSnippetsBtn: (snippetsContainer: HTMLElement) => HTMLButtonElement; export const getBroadcastStatusLabel: (broadcastContainer: HTMLElement) => HTMLElement; export const getBroadcastForm: (broadcastContainer: HTMLElement) => HTMLFormElement; export const getBroadcastServerUrlInput: (broadcastContainer: HTMLElement) => HTMLInputElement; export const getBroadcastSourceCheckbox: (broadcastContainer: HTMLElement) => HTMLInputElement; export const getBroadcastBtn: (broadcastContainer: HTMLElement) => HTMLButtonElement; export const getBroadcastChannelUrlSection: (broadcastContainer: HTMLElement) => HTMLElement; export const getBroadcastChannelUrl: (broadcastContainer: HTMLElement) => HTMLAnchorElement; export const getBroadcastStatusBtn: () => HTMLElement | null; export const getQrCodeContainer: () => HTMLElement; export const getEditorSettingsFormatLink: (editorSettingsContainer: HTMLElement) => HTMLAnchorElement; export const getWelcomeLinkNew: (welcomeContainer: HTMLElement) => HTMLAnchorElement; export const getWelcomeLinkOpen: (welcomeContainer: HTMLElement) => HTMLAnchorElement; export const getWelcomeLinkImport: (welcomeContainer: HTMLElement) => HTMLAnchorElement; export const getWelcomeLinkDefaultTemplateLi: (welcomeContainer: HTMLElement) => HTMLAnchorElement; export const getWelcomeLinkNoDefaultTemplate: (welcomeContainer: HTMLElement) => HTMLAnchorElement; export const getWelcomeLinkLoadDefault: (welcomeContainer: HTMLElement) => HTMLAnchorElement; export const getWelcomeLinkRecentOpen: (welcomeContainer: HTMLElement) => HTMLAnchorElement; export const getWelcomeLinkTemplates: (welcomeContainer: HTMLElement) => HTMLAnchorElement; export const getModalShowWelcomeCheckbox: (welcomeContainer: HTMLElement) => HTMLInputElement; export const getModalWelcomeRecover: (welcomeContainer?: Document) => HTMLElement; export const getModalWelcomeScreen: (welcomeContainer: HTMLElement) => HTMLElement; export const getModalWelcomeRecent: (welcomeContainer: HTMLElement) => HTMLElement; export const getModalWelcomeRecentList: (welcomeContainer: HTMLElement) => HTMLElement; export const getModalWelcomeTemplateList: (welcomeContainer: HTMLElement) => HTMLElement; export const getNinjaKeys: () => any; export const getResultModeDrawer: () => HTMLElement; } declare module "livecodes/UI/login" { import type { EventsManager, GithubScope, User } from "livecodes/models"; export const createLoginContainer: (eventsManager: EventsManager, loginCallback: (scopes: GithubScope[]) => void) => HTMLElement; export const displayLoggedIn: (user: User) => void; export const displayLoggedOut: () => void; } declare module "livecodes/utils/get-import-instance" { export function getImportInstance(url: string): any; } declare module "livecodes/utils/index" { export * from "livecodes/utils/get-import-instance"; export * from "livecodes/utils/utils"; } declare module "livecodes/UI/open" { import type { Config, ContentConfig, EventsManager, Language, LanguageSpecs, Modal, Notifications, Screen } from "livecodes/models"; import type { ProjectStorage, SavedProject } from "livecodes/storage/index"; export const createOpenItem: (item: SavedProject, list: HTMLElement, getLanguageTitle: (language: Language) => string, getLanguageByAlias: (alias?: string) => Language | undefined, isTemplate?: boolean) => { link: HTMLAnchorElement; deleteButton: HTMLButtonElement; setAsDefaultLink: HTMLSpanElement; removeDefaultLink: HTMLSpanElement; }; export const createSavedProjectsList: ({ projectStorage, eventsManager, showScreen, getContentConfig, notifications, modal, loadConfig, getProjectId, setProjectId, languages, getLanguageTitle, getLanguageByAlias, }: { projectStorage: ProjectStorage; eventsManager: EventsManager; showScreen: (screen: Screen['screen']) => void; getContentConfig: (config: Config | ContentConfig) => ContentConfig; notifications: Notifications; modal: Modal; loadConfig: (config: ContentConfig) => Promise; getProjectId: () => string | undefined; setProjectId: (id: string) => void; languages: LanguageSpecs[]; getLanguageTitle: (language: Language) => string; getLanguageByAlias: (alias?: string) => Language | undefined; }) => Promise; } declare module "livecodes/UI/split-panes" { export const createSplitPanes: (layout?: 'vertical' | 'horizontal') => { show: (pane: 'code' | 'output' | 'toggle', full?: boolean) => void; getLayout: () => "horizontal" | "vertical"; setLayout: (newLayout: 'vertical' | 'horizontal') => void; destroy: (preserveStyles?: boolean | undefined, preserveGutters?: boolean | undefined) => void; }; } declare module "livecodes/UI/templates" { import type { EventsManager, Template } from "livecodes/models"; export const createTemplatesContainer: (eventsManager: EventsManager, loadUserTemplates: () => void) => HTMLElement; export const createStarterTemplateLink: (template: Template, starterTemplatesList: HTMLElement | null, baseUrl: string) => HTMLAnchorElement; export const noUserTemplates: () => string; } declare module "livecodes/UI/index" { export * from "livecodes/UI/info"; export * from "livecodes/UI/loading"; export * from "livecodes/UI/login"; export * from "livecodes/UI/open"; export * from "livecodes/UI/selectors"; export * from "livecodes/UI/split-panes"; export * from "livecodes/UI/templates"; } declare module "livecodes/languages/css-presets" { import type { CssPreset } from "livecodes/models"; export const cssPresets: CssPreset[]; } declare module "livecodes/languages/prettier" { export const prettierUrl: string; export const parserPlugins: { babel: string; estree: string; glimmer: string; html: string; markdown: string; postcss: string; php: string; pug: string; java: string; }; } declare module "livecodes/languages/art-template/lang-art-template" { import type { LanguageSpecs } from "livecodes/models"; export const artTemplate: LanguageSpecs; } declare module "livecodes/languages/art-template/index" { export * from "livecodes/languages/art-template/lang-art-template"; } declare module "livecodes/languages/lightningcss/processor-lightningcss" { import type { ProcessorSpecs } from "livecodes/models"; export const lightningcss: ProcessorSpecs; } declare module "livecodes/languages/lightningcss/index" { export * from "livecodes/languages/lightningcss/processor-lightningcss"; } declare module "livecodes/languages/postcss/postcss-plugins" { import type { ProcessorSpecs } from "livecodes/models"; export const autoprefixer: ProcessorSpecs; export const cssnano: ProcessorSpecs; export const postcssImportUrl: ProcessorSpecs; export const postcssPresetEnv: ProcessorSpecs; export const purgecss: ProcessorSpecs; export const tokencss: ProcessorSpecs; export const cssModules: ProcessorSpecs; } declare module "livecodes/languages/postcss/processor-postcss" { import type { ProcessorSpecs } from "livecodes/models"; export const postcss: ProcessorSpecs; } declare module "livecodes/languages/postcss/index" { export * from "livecodes/languages/postcss/postcss-plugins"; export * from "livecodes/languages/postcss/processor-postcss"; } declare module "livecodes/languages/tailwindcss/processor-tailwindcss" { import type { ProcessorSpecs } from "livecodes/models"; export const tailwindcss: ProcessorSpecs; } declare module "livecodes/languages/tailwindcss/index" { export * from "livecodes/languages/tailwindcss/processor-tailwindcss"; } declare module "livecodes/languages/unocss/processor-unocss" { import type { ProcessorSpecs } from "livecodes/models"; export const unocss: ProcessorSpecs; } declare module "livecodes/languages/unocss/index" { export * from "livecodes/languages/unocss/processor-unocss"; } declare module "livecodes/languages/windicss/processor-windicss" { import type { ProcessorSpecs } from "livecodes/models"; export const windicss: ProcessorSpecs; } declare module "livecodes/languages/windicss/index" { export * from "livecodes/languages/windicss/processor-windicss"; } declare module "livecodes/languages/processors" { import type { ProcessorSpecs } from "livecodes/models"; export const processors: ProcessorSpecs[]; } declare module "livecodes/languages/utils" { import type { Compiler, Config, CustomSettings, Language, Processor } from "livecodes/models"; import { getLanguageCustomSettings } from "livecodes/utils/utils"; export const getLanguageByAlias: (alias?: string) => Language | undefined; export const getLanguageTitle: (language: Language) => string; export const getLanguageEditorId: (alias?: string) => import("sdk/models").EditorId | undefined; export const getLanguageExtension: (alias?: string) => Language | undefined; export const getLanguageSpecs: (alias?: string) => import("sdk/models").LanguageSpecs | undefined; export const getLanguageCompiler: (alias?: string) => Compiler | undefined; export const mapLanguage: (language: Language) => Language; export const languageIsEnabled: (language: Language, config: Config) => boolean; export const processorIsEnabled: (processor: Processor, config: Config) => boolean; export const processorIsActivated: (processor: Processor, config: Config) => boolean; /** * returns a string with names of enabled processors/postcss plugins * for the supplied language (separated by hyphens) */ export const getActivatedProcessors: (language: Language, config: Config) => string; export const escapeCode: (code: string, slash?: boolean) => string; export const getCustomSettings: (language: Language | Processor, config: Config) => CustomSettings; export const detectLanguage: (code: string, languages: Language[]) => Promise<{ language: Language; secondBest: Language; }>; export { getLanguageCustomSettings }; } declare module "livecodes/languages/asciidoc/lang-asciidoc" { import type { LanguageSpecs } from "livecodes/models"; export const asciidoc: LanguageSpecs; } declare module "livecodes/languages/asciidoc/index" { export * from "livecodes/languages/asciidoc/lang-asciidoc"; } declare module "livecodes/languages/assemblyscript/lang-assemblyscript" { import type { LanguageSpecs } from "livecodes/models"; export const assemblyscript: LanguageSpecs; } declare module "livecodes/languages/assemblyscript/index" { export * from "livecodes/languages/assemblyscript/lang-assemblyscript"; } declare module "livecodes/languages/astro/lang-astro" { import type { LanguageSpecs } from "livecodes/models"; export const astro: LanguageSpecs; } declare module "livecodes/languages/astro/index" { export * from "livecodes/languages/astro/lang-astro"; } declare module "livecodes/languages/babel/lang-babel" { import type { LanguageSpecs } from "livecodes/models"; export const babel: LanguageSpecs; } declare module "livecodes/languages/babel/index" { export * from "livecodes/languages/babel/lang-babel"; } declare module "livecodes/languages/bbcode/lang-bbcode" { import type { LanguageSpecs } from "livecodes/models"; export const bbcode: LanguageSpecs; } declare module "livecodes/languages/bbcode/index" { export * from "livecodes/languages/bbcode/lang-bbcode"; } declare module "livecodes/languages/blockly/lang-blockly" { import type { LanguageSpecs } from "livecodes/models"; export const blockly: LanguageSpecs; } declare module "livecodes/languages/blockly/index" { export * from "livecodes/languages/blockly/lang-blockly"; } declare module "livecodes/languages/civet/lang-civet" { import type { LanguageSpecs } from "livecodes/models"; export const civet: LanguageSpecs; } declare module "livecodes/languages/civet/index" { export * from "livecodes/languages/civet/lang-civet"; } declare module "livecodes/languages/clio/lang-clio" { import type { LanguageSpecs } from "livecodes/models"; export const clio: LanguageSpecs; } declare module "livecodes/languages/clio/index" { export * from "livecodes/languages/clio/lang-clio"; } declare module "livecodes/compiler/models" { import type { CompileOptions, CompileResult, Config, Language, Processor } from "livecodes/models"; export interface Compiler { load: (languages: LanguageOrProcessor[], config: Config) => Promise; compile: (content: string, language: Language, config: Config, options: CompileOptions) => Promise; clearCache: () => void; typescriptFeatures: (options: { feature: TypescriptFeatures; payload: any; }) => Promise; isFake: boolean; } export type LanguageOrProcessor = Language | Processor; export type TypescriptFeatures = 'getOptionDeclarations' | 'ata' | 'initCodeMirrorTS' | 'changeCodeMirrorLanguage' | 'addTypes'; export interface CompilerMessageEvent extends MessageEvent { data: CompilerMessage; } export type CompilerMessage = { from?: 'compiler'; } & (InitMessage | InitSuccessMessage | LoadMessage | LoadedMessage | LoadFailedMessage | CompileMessage | CompileInCompilerMessage | CompiledMessage | CompileFailedMessage | TypeScriptMessage); export interface InitMessage { type: 'init'; payload: Config; baseUrl: string; scriptUrl: string; } export interface InitSuccessMessage { type: 'init-success'; } export interface LoadMessage { type: 'load'; payload: { language: LanguageOrProcessor; config: Config; }; } export interface LoadedMessage { type: 'loaded'; payload: LanguageOrProcessor; } export interface LoadFailedMessage { type: 'load-failed'; payload: LanguageOrProcessor; } export interface CompileMessage { type: 'compile'; payload: { content: string; language: LanguageOrProcessor; config: Config; options: any; }; } export interface CompileInCompilerMessage { type: 'compileInCompiler'; payload: { content: string; language: LanguageOrProcessor; config: Config; options: any; }; } export interface CompiledMessage { type: 'compiled'; trigger: 'compile' | 'compileInCompiler'; payload: { content: string; language: LanguageOrProcessor; compiled: string | CompileResult; config: Config; options: any; }; } export interface CompileFailedMessage { type: 'compile-failed'; trigger: 'compile' | 'compileInCompiler'; payload: { content: string; language: LanguageOrProcessor; error: string; }; } export interface TypeScriptMessage { type: 'ts-features'; payload: { id: string; feature: TypescriptFeatures; data: any; }; } } declare module "livecodes/compiler/utils" { import type { CompileResult, CompilerFunction } from "livecodes/models"; export const getCompileResult: (result: Awaited>) => CompileResult; } declare module "livecodes/compiler/compile-in-compiler" { import type { CompileOptions, CompileResult, Config } from "livecodes/models"; import type { LanguageOrProcessor } from "livecodes/compiler/models"; export const compileInCompiler: (content: string, language: LanguageOrProcessor | undefined, config: Config, options?: CompileOptions, worker?: Worker) => Promise; } declare module "livecodes/compiler/import-map" { import type { CompileInfo, Config, Language } from "livecodes/models"; export const importsPattern: RegExp; export const dynamicImportsPattern: RegExp; export const getImports: (code: string, removeSpecifier?: boolean) => string[]; export const isBare: (mod: string) => boolean; export const findImportMapKey: (mod: string, importmap: Record) => string | undefined; export const createImportMap: (code: string, config: Config, { fallbackToCdn, external }?: { fallbackToCdn?: boolean; external?: string; }) => { [x: string]: string; }; export const hasImports: (code: string) => boolean; export const hasExports: (code: string) => boolean; export const hasDefaultExport: (code: string) => boolean; export const hasUrlImportsOrExports: (code: string) => boolean; export const hasAwait: (code: string) => boolean; export const isModuleScript: (code: string) => boolean; export const replaceImports: (code: string, config: Config, { importMap, external }?: { importMap?: Record; external?: string; }) => string; export const isScriptImport: (mod: string) => boolean; export const replaceSFCImports: (code: string, { filename, config, isSfc, getLanguageByAlias, compileSFC, external, }: { config: Config; filename: string; isSfc: (mod: string) => boolean; getLanguageByAlias: (alias: string) => Language | undefined; compileSFC: (code: string, options: { filename: string; config: Config; }) => Promise; external?: string; }) => Promise; export const removeImports: (code: string, mods: string[]) => string; export const styleimportsPattern: RegExp; export const hasStyleImports: (code: string) => boolean; export const replaceStyleImports: (code: string, exceptions?: string[] | RegExp[]) => string; export const cjs2esm: (code: string) => string; export const createCSSModulesImportMap: (compiledScript: string, compiledStyle: string, cssTokens?: CompileInfo['cssModules'], extension?: Language) => { [x: string]: string; }; } declare module "livecodes/compiler/compile-blocks" { import type { Config } from "livecodes/models"; import type { LanguageOrProcessor } from "livecodes/compiler/models"; interface CompileBlocksOptions { removeEnclosingTemplate?: boolean; languageAttribute?: 'lang' | 'type'; prepareFn?: (code: string, config: Config) => Promise; skipCompilers?: LanguageOrProcessor[]; } /** * This is a workaround to prevent typescript removing default imports (components) * that are not used in the typescript code but are used in the template * by exporting them * e.g. * * */ export const exportDefaultImports: (code: string) => string; export const fetchBlocksSource: (code: string, blockElement: 'template' | 'style' | 'script') => Promise; export const compileBlocks: (code: string, blockElement: 'template' | 'style' | 'script', config: Config, options?: CompileBlocksOptions) => Promise; export const compileAllBlocks: (code: string, config: Config, options?: CompileBlocksOptions) => Promise; } declare module "livecodes/compiler/get-all-compilers" { import type { Compilers, Config, LanguageSpecs, ProcessorSpecs } from "livecodes/models"; export const getAllCompilers: (languages: Array, config: Config, baseUrl: string) => Compilers; } declare module "livecodes/services/allowed-origin" { export const allowedOrigin: (origin?: string) => boolean; export const whitelistTarget: (url: string) => boolean; } declare module "livecodes/services/auth" { import type { GithubScope, User } from "livecodes/models"; interface AuthService { load(): Promise; getUser(): Promise; signIn(scopes?: GithubScope[]): Promise; signOut(): Promise; isLoggedIn(): boolean; } export const createAuthService: (isEmbed: boolean) => AuthService; } declare module "livecodes/services/broadcast" { export const broadcastService: { getUrl: () => string; }; } declare module "livecodes/services/cors" { export const corsService: { fetch: (url: string, options?: RequestInit) => Promise; }; } declare module "livecodes/services/sandbox" { export const sandboxService: { getResultUrl: () => string; getCompilerUrl: () => string; getOrigin: () => string; }; } declare module "livecodes/services/share" { import type { Config } from "livecodes/models"; type ConfigWithResult = Partial; interface ShareService { getProject: (id: string) => Promise; shareProject: (config: ConfigWithResult) => Promise; } export const shareService: ShareService; } declare module "livecodes/services/utils" { export const removeCDNPrefix: (url: string) => string; export const removeSpecifier: (type: string) => string; } declare module "livecodes/services/types" { import type { Types } from "livecodes/models"; export const typesService: { getTypeUrls: (types: string[]) => Promise; getTypesAsImports: (types: string[]) => string; }; } declare module "livecodes/services/index" { export * from "livecodes/services/allowed-origin"; export * from "livecodes/services/auth"; export * from "livecodes/services/broadcast"; export * from "livecodes/services/cors"; export * from "livecodes/services/modules"; export * from "livecodes/services/sandbox"; export * from "livecodes/services/share"; export * from "livecodes/services/types"; } declare module "livecodes/compiler/compiler-sandbox" { export const createCompilerSandbox: (sandboxUrl: string) => Promise; } declare module "livecodes/compiler/create-compiler" { import type { Config } from "livecodes/models"; import type { Compiler } from "livecodes/compiler/models"; export const createCompiler: ({ config, baseUrl, eventsManager, }: { config: Config; baseUrl: string; eventsManager: any; }) => Promise; } declare module "livecodes/compiler/get-compiler" { import type { Config, EventsManager } from "livecodes/models"; import type { Compiler } from "livecodes/compiler/models"; export const getCompiler: (options: { config: Config; baseUrl: string; eventsManager: EventsManager; }) => Promise; } declare module "livecodes/compiler/index" { export * from "livecodes/compiler/compile-blocks"; export * from "livecodes/compiler/compile-in-compiler"; export * from "livecodes/compiler/get-all-compilers"; export * from "livecodes/compiler/get-compiler"; export * from "livecodes/compiler/import-map"; export * from "livecodes/compiler/utils"; } declare module "livecodes/languages/commonlisp/lang-commonlisp" { import type { LanguageSpecs } from "livecodes/models"; export const parenFormatter: () => (value: string) => Promise<{ formatted: any; cursorOffset: number; }>; export const commonlisp: LanguageSpecs; } declare module "livecodes/languages/commonlisp/index" { export * from "livecodes/languages/commonlisp/lang-commonlisp"; } declare module "livecodes/languages/clojurescript/lang-clojurescript" { import type { LanguageSpecs } from "livecodes/models"; export const clojurescript: LanguageSpecs; } declare module "livecodes/languages/clojurescript/index" { export * from "livecodes/languages/clojurescript/lang-clojurescript"; } declare module "livecodes/languages/coffeescript/lang-coffeescript" { import type { LanguageSpecs } from "livecodes/models"; export const coffeescript: LanguageSpecs; } declare module "livecodes/languages/coffeescript/index" { export * from "livecodes/languages/coffeescript/lang-coffeescript"; } declare module "livecodes/languages/cpp/lang-cpp" { import type { LanguageSpecs } from "livecodes/models"; export const cdnUrl: string; export const cpp: LanguageSpecs; } declare module "livecodes/languages/cpp/index" { export * from "livecodes/languages/cpp/lang-cpp"; } declare module "livecodes/languages/cpp-wasm/lang-cpp-wasm" { import type { LanguageSpecs } from "livecodes/models"; export const cppWasm: LanguageSpecs; } declare module "livecodes/languages/cpp-wasm/index" { export * from "livecodes/languages/cpp-wasm/lang-cpp-wasm"; } declare module "livecodes/languages/csharp-wasm/lang-csharp-wasm" { import type { LanguageSpecs } from "livecodes/models"; export const csharpWasm: LanguageSpecs; } declare module "livecodes/languages/csharp-wasm/index" { export * from "livecodes/languages/csharp-wasm/lang-csharp-wasm"; } declare module "livecodes/languages/css/lang-css" { import type { LanguageSpecs } from "livecodes/models"; export const css: LanguageSpecs; } declare module "livecodes/languages/css/index" { export * from "livecodes/languages/css/lang-css"; } declare module "livecodes/languages/diagrams/lang-diagrams" { import type { CompilerFunction, LanguageSpecs } from "livecodes/models"; export const runOutsideWorker: CompilerFunction; export const diagrams: LanguageSpecs; } declare module "livecodes/languages/diagrams/index" { export * from "livecodes/languages/diagrams/lang-diagrams"; } declare module "livecodes/languages/dot/lang-dot" { import type { LanguageSpecs } from "livecodes/models"; export const dot: LanguageSpecs; } declare module "livecodes/languages/dot/index" { export * from "livecodes/languages/dot/lang-dot"; } declare module "livecodes/languages/ejs/lang-ejs" { import type { LanguageSpecs } from "livecodes/models"; export const ejs: LanguageSpecs; } declare module "livecodes/languages/ejs/index" { export * from "livecodes/languages/ejs/lang-ejs"; } declare module "livecodes/languages/eta/lang-eta" { import type { LanguageSpecs } from "livecodes/models"; export const eta: LanguageSpecs; } declare module "livecodes/languages/eta/index" { export * from "livecodes/languages/eta/lang-eta"; } declare module "livecodes/languages/fennel/lang-fennel" { import type { LanguageSpecs } from "livecodes/models"; export const fennel: LanguageSpecs; } declare module "livecodes/languages/fennel/index" { export * from "livecodes/languages/fennel/lang-fennel"; } declare module "livecodes/languages/flow/lang-flow" { import type { LanguageSpecs } from "livecodes/models"; export const flow: LanguageSpecs; } declare module "livecodes/languages/flow/index" { export * from "livecodes/languages/flow/lang-flow"; } declare module "livecodes/languages/gleam/lang-gleam" { import type { LanguageSpecs } from "livecodes/models"; export const gleam: LanguageSpecs; } declare module "livecodes/languages/gleam/index" { export * from "livecodes/languages/gleam/lang-gleam"; } declare module "livecodes/languages/go/lang-go" { import type { LanguageSpecs } from "livecodes/models"; export const go: LanguageSpecs; } declare module "livecodes/languages/go/index" { export * from "livecodes/languages/go/lang-go"; } declare module "livecodes/languages/haml/lang-haml" { import type { LanguageSpecs } from "livecodes/models"; export const haml: LanguageSpecs; } declare module "livecodes/languages/haml/index" { export * from "livecodes/languages/haml/lang-haml"; } declare module "livecodes/languages/handlebars/lang-handlebars" { import type { LanguageSpecs } from "livecodes/models"; export const runtimeUrl: string; export const handlebars: LanguageSpecs; } declare module "livecodes/languages/handlebars/index" { export * from "livecodes/languages/handlebars/lang-handlebars"; } declare module "livecodes/languages/html/lang-html" { import type { LanguageSpecs } from "livecodes/models"; export const html: LanguageSpecs; } declare module "livecodes/languages/html/index" { export * from "livecodes/languages/html/lang-html"; } declare module "livecodes/languages/imba/lang-imba" { import type { LanguageSpecs } from "livecodes/models"; export const imba: LanguageSpecs; } declare module "livecodes/languages/imba/index" { export * from "livecodes/languages/imba/lang-imba"; } declare module "livecodes/languages/java/lang-java" { import type { LanguageSpecs } from "livecodes/models"; export const java: LanguageSpecs; } declare module "livecodes/languages/java/index" { export * from "livecodes/languages/java/lang-java"; } declare module "livecodes/languages/javascript/lang-javascript" { import type { LanguageSpecs } from "livecodes/models"; export const javascript: LanguageSpecs; } declare module "livecodes/languages/javascript/index" { export * from "livecodes/languages/javascript/lang-javascript"; } declare module "livecodes/languages/jinja/lang-jinja" { import type { LanguageSpecs } from "livecodes/models"; export const jinjaUrl: string; export const jinja: LanguageSpecs; } declare module "livecodes/languages/jinja/index" { export * from "livecodes/languages/jinja/lang-jinja"; } declare module "livecodes/languages/jsx/lang-jsx" { import type { LanguageSpecs } from "livecodes/models"; export const jsx: LanguageSpecs; } declare module "livecodes/languages/jsx/lang-tsx" { import type { LanguageSpecs } from "livecodes/models"; export const tsx: LanguageSpecs; } declare module "livecodes/languages/jsx/index" { export * from "livecodes/languages/jsx/lang-jsx"; export * from "livecodes/languages/jsx/lang-tsx"; } declare module "livecodes/languages/julia/lang-julia" { import type { LanguageSpecs } from "livecodes/models"; export const julia: LanguageSpecs; } declare module "livecodes/languages/julia/index" { export * from "livecodes/languages/julia/lang-julia"; } declare module "livecodes/languages/less/lang-less" { import type { LanguageSpecs } from "livecodes/models"; export const less: LanguageSpecs; } declare module "livecodes/languages/less/index" { export * from "livecodes/languages/less/lang-less"; } declare module "livecodes/languages/liquid/lang-liquid" { import type { LanguageSpecs } from "livecodes/models"; export const liquid: LanguageSpecs; } declare module "livecodes/languages/liquid/index" { export * from "livecodes/languages/liquid/lang-liquid"; } declare module "livecodes/languages/livescript/lang-livescript" { import type { LanguageSpecs } from "livecodes/models"; export const livescript: LanguageSpecs; } declare module "livecodes/languages/livescript/index" { export * from "livecodes/languages/livescript/lang-livescript"; } declare module "livecodes/languages/lua/lang-lua" { import type { LanguageFormatter, LanguageSpecs } from "livecodes/models"; export const luaFormatter: LanguageFormatter; export const lua: LanguageSpecs; } declare module "livecodes/languages/lua/index" { export * from "livecodes/languages/lua/lang-lua"; } declare module "livecodes/languages/lua-wasm/lang-lua-wasm" { import type { LanguageSpecs } from "livecodes/models"; export const luaWasm: LanguageSpecs; } declare module "livecodes/languages/lua-wasm/index" { export * from "livecodes/languages/lua-wasm/lang-lua-wasm"; } declare module "livecodes/languages/malina/lang-malina" { import type { LanguageSpecs } from "livecodes/models"; export const malina: LanguageSpecs; } declare module "livecodes/languages/malina/index" { export * from "livecodes/languages/malina/lang-malina"; } declare module "livecodes/languages/markdown/lang-markdown" { import type { LanguageSpecs } from "livecodes/models"; export const markdown: LanguageSpecs; } declare module "livecodes/languages/markdown/index" { export * from "livecodes/languages/markdown/lang-markdown"; } declare module "livecodes/languages/mdx/lang-mdx" { import type { CompilerFunction, LanguageSpecs } from "livecodes/models"; export const runOutsideWorker: CompilerFunction; export const mdx: LanguageSpecs; } declare module "livecodes/languages/mdx/index" { export * from "livecodes/languages/mdx/lang-mdx"; } declare module "livecodes/languages/mjml/lang-mjml" { import type { LanguageSpecs } from "livecodes/models"; export const mjml: LanguageSpecs; } declare module "livecodes/languages/mjml/index" { export * from "livecodes/languages/mjml/lang-mjml"; } declare module "livecodes/languages/mustache/lang-mustache" { import type { LanguageSpecs } from "livecodes/models"; export const mustache: LanguageSpecs; } declare module "livecodes/languages/mustache/index" { export * from "livecodes/languages/mustache/lang-mustache"; } declare module "livecodes/languages/nunjucks/lang-nunjucks" { import type { LanguageSpecs } from "livecodes/models"; export const runtimeUrl: string; export const nunjucks: LanguageSpecs; } declare module "livecodes/languages/nunjucks/index" { export * from "livecodes/languages/nunjucks/lang-nunjucks"; } declare module "livecodes/languages/ocaml/lang-ocaml" { import type { LanguageSpecs } from "livecodes/models"; export const ocaml: LanguageSpecs; } declare module "livecodes/languages/ocaml/index" { export * from "livecodes/languages/ocaml/lang-ocaml"; } declare module "livecodes/languages/perl/lang-perl" { import type { LanguageSpecs } from "livecodes/models"; export const perl: LanguageSpecs; } declare module "livecodes/languages/perl/index" { export * from "livecodes/languages/perl/lang-perl"; } declare module "livecodes/languages/php/lang-php" { import type { LanguageSpecs } from "livecodes/models"; export const php: LanguageSpecs; } declare module "livecodes/languages/php/index" { export * from "livecodes/languages/php/lang-php"; } declare module "livecodes/languages/php-wasm/lang-php-wasm" { import type { LanguageSpecs } from "livecodes/models"; export const phpWasm: LanguageSpecs; } declare module "livecodes/languages/php-wasm/index" { export * from "livecodes/languages/php-wasm/lang-php-wasm"; } declare module "livecodes/languages/postgresql/lang-postgresql" { import type { CompilerFunction, LanguageSpecs } from "livecodes/models"; export const runOutsideWorker: CompilerFunction; export const postgresql: LanguageSpecs; } declare module "livecodes/languages/postgresql/index" { export * from "livecodes/languages/postgresql/lang-postgresql"; } declare module "livecodes/languages/prolog/lang-prolog" { import type { LanguageSpecs } from "livecodes/models"; export const prolog: LanguageSpecs; } declare module "livecodes/languages/prolog/index" { export * from "livecodes/languages/prolog/lang-prolog"; } declare module "livecodes/languages/pug/lang-pug" { import type { LanguageSpecs } from "livecodes/models"; export const pug: LanguageSpecs; } declare module "livecodes/languages/pug/index" { export * from "livecodes/languages/pug/lang-pug"; } declare module "livecodes/languages/python/lang-python" { import type { LanguageSpecs } from "livecodes/models"; export const python: LanguageSpecs; } declare module "livecodes/languages/python/index" { export * from "livecodes/languages/python/lang-python"; } declare module "livecodes/languages/python-wasm/lang-python-wasm" { import type { LanguageSpecs } from "livecodes/models"; export const pythonWasm: LanguageSpecs; } declare module "livecodes/languages/python-wasm/index" { export * from "livecodes/languages/python-wasm/lang-python-wasm"; } declare module "livecodes/languages/r/lang-r" { import type { LanguageSpecs } from "livecodes/models"; export const r: LanguageSpecs; } declare module "livecodes/languages/r/index" { export * from "livecodes/languages/r/lang-r"; } declare module "livecodes/languages/react/lang-react" { import type { LanguageSpecs } from "livecodes/models"; export const react: LanguageSpecs; } declare module "livecodes/languages/react/lang-react-tsx" { import type { LanguageSpecs } from "livecodes/models"; export const reactTsx: LanguageSpecs; } declare module "livecodes/languages/react/index" { export * from "livecodes/languages/react/lang-react"; export * from "livecodes/languages/react/lang-react-tsx"; } declare module "livecodes/languages/typescript/lang-typescript" { import type { Config, LanguageSpecs } from "livecodes/models"; export const hasCustomJsxRuntime: (code: string, config: Config) => boolean; export const typescriptOptions: { target: string; jsx: string; allowUmdGlobalAccess: boolean; esModuleInterop: boolean; }; export const typescript: LanguageSpecs; } declare module "livecodes/languages/typescript/index" { export * from "livecodes/languages/typescript/lang-typescript"; } declare module "livecodes/languages/react-native/lang-react-native" { import type { LanguageSpecs } from "livecodes/models"; export const reactNative: LanguageSpecs; } declare module "livecodes/languages/react-native/lang-react-native-tsx" { import type { LanguageSpecs } from "livecodes/models"; export const reactNativeTsx: LanguageSpecs; } declare module "livecodes/languages/react-native/index" { export * from "livecodes/languages/react-native/lang-react-native"; export * from "livecodes/languages/react-native/lang-react-native-tsx"; } declare module "livecodes/languages/rescript/lang-rescript" { import type { CompilerFunction, LanguageFormatter, LanguageSpecs } from "livecodes/models"; export const runOutsideWorker: CompilerFunction; export const formatterFactory: LanguageFormatter['factory']; export const rescript: LanguageSpecs; } declare module "livecodes/languages/rescript/index" { export * from "livecodes/languages/rescript/lang-rescript"; } declare module "livecodes/languages/reason/lang-reason" { import type { LanguageSpecs } from "livecodes/models"; export const reason: LanguageSpecs; } declare module "livecodes/languages/reason/index" { export * from "livecodes/languages/reason/lang-reason"; } declare module "livecodes/languages/richtext/lang-richtext" { import type { LanguageSpecs } from "livecodes/models"; export const richtext: LanguageSpecs; } declare module "livecodes/languages/richtext/index" { export * from "livecodes/languages/richtext/lang-richtext"; } declare module "livecodes/languages/riot/lang-riot" { import type { LanguageSpecs } from "livecodes/models"; export const riot: LanguageSpecs; } declare module "livecodes/languages/riot/index" { export * from "livecodes/languages/riot/lang-riot"; } declare module "livecodes/languages/ruby/lang-ruby" { import type { LanguageSpecs } from "livecodes/models"; export const ruby: LanguageSpecs; } declare module "livecodes/languages/ruby/index" { export * from "livecodes/languages/ruby/lang-ruby"; } declare module "livecodes/languages/ruby-wasm/lang-ruby-wasm" { import type { LanguageSpecs } from "livecodes/models"; export const rubyWasm: LanguageSpecs; } declare module "livecodes/languages/ruby-wasm/index" { export * from "livecodes/languages/ruby-wasm/lang-ruby-wasm"; } declare module "livecodes/languages/scheme/lang-scheme" { import type { LanguageSpecs } from "livecodes/models"; export const scheme: LanguageSpecs; } declare module "livecodes/languages/scheme/index" { export * from "livecodes/languages/scheme/lang-scheme"; } declare module "livecodes/languages/scss/lang-sass" { import type { LanguageSpecs } from "livecodes/models"; export const sass: LanguageSpecs; } declare module "livecodes/languages/scss/lang-scss" { import type { LanguageSpecs } from "livecodes/models"; export const scss: LanguageSpecs; } declare module "livecodes/languages/scss/index" { export * from "livecodes/languages/scss/lang-sass"; export * from "livecodes/languages/scss/lang-scss"; } declare module "livecodes/languages/solid/lang-solid" { import type { LanguageSpecs } from "livecodes/models"; export const solid: LanguageSpecs; } declare module "livecodes/languages/solid/lang-solid-tsx" { import type { LanguageSpecs } from "livecodes/models"; export const solidTsx: LanguageSpecs; } declare module "livecodes/languages/solid/index" { export * from "livecodes/languages/solid/lang-solid"; export * from "livecodes/languages/solid/lang-solid-tsx"; } declare module "livecodes/languages/sql/lang-sql" { import type { LanguageSpecs } from "livecodes/models"; export const scriptType = "application/json"; export const sql: LanguageSpecs; } declare module "livecodes/languages/sql/index" { export * from "livecodes/languages/sql/lang-sql"; } declare module "livecodes/languages/stencil/lang-stencil" { import type { LanguageSpecs } from "livecodes/models"; export const stencil: LanguageSpecs; } declare module "livecodes/languages/stencil/index" { export * from "livecodes/languages/stencil/lang-stencil"; } declare module "livecodes/languages/stylis/lang-stylis" { import type { LanguageSpecs } from "livecodes/models"; export const stylis: LanguageSpecs; } declare module "livecodes/languages/stylis/index" { export * from "livecodes/languages/stylis/lang-stylis"; } declare module "livecodes/languages/stylus/lang-stylus" { import type { LanguageSpecs } from "livecodes/models"; export const stylus: LanguageSpecs; } declare module "livecodes/languages/stylus/index" { export * from "livecodes/languages/stylus/lang-stylus"; } declare module "livecodes/languages/sucrase/lang-sucrase" { import type { LanguageSpecs } from "livecodes/models"; export const sucrase: LanguageSpecs; } declare module "livecodes/languages/sucrase/index" { export * from "livecodes/languages/sucrase/lang-sucrase"; } declare module "livecodes/languages/svelte/lang-svelte" { import type { LanguageSpecs } from "livecodes/models"; export const svelte: LanguageSpecs; export const svelteApp: LanguageSpecs; } declare module "livecodes/languages/svelte/index" { export * from "livecodes/languages/svelte/lang-svelte"; } declare module "livecodes/languages/tcl/lang-tcl" { import type { LanguageSpecs } from "livecodes/models"; export const tcl: LanguageSpecs; } declare module "livecodes/languages/tcl/index" { export * from "livecodes/languages/tcl/lang-tcl"; } declare module "livecodes/languages/teal/lang-teal" { import type { LanguageSpecs } from "livecodes/models"; export const teal: LanguageSpecs; } declare module "livecodes/languages/teal/index" { export * from "livecodes/languages/teal/lang-teal"; } declare module "livecodes/languages/twig/lang-twig" { import type { LanguageSpecs } from "livecodes/models"; export const twig: LanguageSpecs; } declare module "livecodes/languages/twig/index" { export * from "livecodes/languages/twig/lang-twig"; } declare module "livecodes/languages/vento/lang-vento" { import type { LanguageSpecs } from "livecodes/models"; export const vento: LanguageSpecs; } declare module "livecodes/languages/vento/index" { export * from "livecodes/languages/vento/lang-vento"; } declare module "livecodes/languages/vue/lang-vue" { import type { LanguageSpecs } from "livecodes/models"; export const vue: LanguageSpecs; export const vueApp: LanguageSpecs; } declare module "livecodes/languages/vue/index" { export * from "livecodes/languages/vue/lang-vue"; } declare module "livecodes/languages/vue2/lang-vue2" { import type { LanguageSpecs } from "livecodes/models"; export const vue2: LanguageSpecs; } declare module "livecodes/languages/vue2/index" { export * from "livecodes/languages/vue2/lang-vue2"; } declare module "livecodes/languages/wat/lang-wat" { import type { LanguageSpecs } from "livecodes/models"; export const scriptType = "application/wasm-uint8"; export const wat: LanguageSpecs; } declare module "livecodes/languages/wat/index" { export * from "livecodes/languages/wat/lang-wat"; } declare module "livecodes/languages/languages" { import type { LanguageSpecs } from "livecodes/models"; export const languages: LanguageSpecs[]; } declare module "livecodes/languages/index" { export * from "livecodes/languages/css-presets"; export * from "livecodes/languages/languages"; export * from "livecodes/languages/postcss/index"; export * from "livecodes/languages/prettier"; export * from "livecodes/languages/processors"; export * from "livecodes/languages/utils"; } declare module "livecodes/config/default-config" { import type { Config } from "livecodes/models"; export const defaultConfig: Config; } declare module "livecodes/config/build-config" { import type { Config, UrlQueryParams } from "livecodes/models"; /** * Builds and validates a configuration object by merging default config with user config and URL params * * @param appConfig - Partial configuration object provided by user * @returns Complete validated configuration object * * The function: * 1. Merges default config with user provided config * 2. Handles special case for 'result' mode tools * 3. Processes URL query parameters * 4. Sets active editor * 5. Fixes language names in final config */ export const buildConfig: (appConfig: Partial) => Config; /** * Extracts and processes URL query parameters and hash parameters, converting them into a structured object * * @param queryParams - The URL search query string. Defaults to parent.location.search * @param hashParams - The URL hash string. Defaults to parent.location.hash * @returns {UrlQueryParams} An object containing processed URL parameters where: * * - Values 'true' and 'false' are converted to boolean * - Empty string values are converted to true * - URL encoded values are decoded * - Special 'params' key content is decompressed and parsed as JSON * - Hash parameters take precedence over query parameters with the same key * * @example * // For URL: http://example.com?foo=bar&empty=&isTrue=true#param=value * getParams() // Returns: { foo: "bar", empty: true, isTrue: true, param: "value" } */ export const getParams: (queryParams?: string, hashParams?: string) => UrlQueryParams; export const loadParamConfig: (config: Config, params: UrlQueryParams) => Partial; } declare module "livecodes/config/upgrade-config" { import type { Config } from "livecodes/models"; interface genericConfig extends Config { [x: string]: any; } export const upgradeConfig: (oldConfig: genericConfig) => genericConfig; export const isEarlier: ({ version, comparedTo }: { version: string; comparedTo: string; }) => boolean; } declare module "livecodes/config/validate-config" { import type { Config } from "livecodes/models"; export const validateConfig: (config: Partial) => Partial; } declare module "livecodes/config/config" { import type { AppConfig, Config, ContentConfig, EditorConfig, FormatterConfig, UserConfig } from "livecodes/models"; export const getConfig: () => Config; export const setConfig: (newConfig: Config) => void; export const getContentConfig: (config: Config | ContentConfig) => ContentConfig; export const getAppConfig: (config: Config | AppConfig) => AppConfig; export const getUserConfig: (config: Config | UserConfig) => UserConfig; export const getEditorConfig: (config: Config | UserConfig) => EditorConfig; export const getFormatterConfig: (config: Config | UserConfig) => FormatterConfig; export const upgradeAndValidate: (config: Partial) => Partial; } declare module "livecodes/config/index" { export * from "livecodes/config/build-config"; export * from "livecodes/config/config"; export * from "livecodes/config/default-config"; } declare module "livecodes/notifications/snackbar" { import type { Action } from '@snackbar/core'; export const darkTheme: { textColor: string; actionColor: string; backgroundColor: string; }; export const lightTheme: { textColor: string; actionColor: string; backgroundColor: string; }; export const infoTheme: { textColor: string; actionColor: string; backgroundColor: string; }; export const successTheme: { textColor: string; actionColor: string; backgroundColor: string; }; export const warningTheme: { textColor: string; actionColor: string; backgroundColor: string; }; export const dangerTheme: { textColor: string; actionColor: string; backgroundColor: string; }; export const closeButton: Action; export const acceptButton: Action; } declare module "livecodes/notifications/create-notifications" { import type { Notifications } from "livecodes/models"; export const hasOpenNotifications: () => boolean; export const createNotifications: () => Notifications; } declare module "livecodes/notifications/index" { export * from "livecodes/notifications/create-notifications"; } declare module "livecodes/UI/accordion" { export const createAccordion: ({ container, single, open, }: { container: HTMLElement | Document; single?: boolean; open?: boolean; }) => void; } declare module "livecodes/UI/modal" { import type { Modal } from "livecodes/models"; export const createModal: (deps: { translate: (container: HTMLElement) => void; isEmbed: boolean; onClose: () => void; }) => Modal; } declare module "livecodes/cache/cache" { import type { Cache, Code, EditorId, Language } from "livecodes/models"; export const getCache: () => Cache; export const setCache: (newCache?: Cache) => void; export const updateCache: (editorId: EditorId, language: Language, modified: string) => void; export const getCachedCode: () => Code; } declare module "livecodes/cache/utils" { import type { Cache, ContentConfig } from "livecodes/models"; export const cacheIsValid: (cache: Cache, config: ContentConfig) => boolean; } declare module "livecodes/cache/index" { export * from "livecodes/cache/cache"; export * from "livecodes/cache/utils"; } declare module "livecodes/export/utils" { import type { getLanguageCompiler as getLanguageCompilerFn, getLanguageExtension as getLanguageExtensionFn } from "livecodes/languages/index"; import type { Config, ContentConfig, EditorId, Language, User } from "livecodes/models"; export interface Files { [key: string]: { content: string; }; } export const getFilesFromConfig: (config: Config | ContentConfig, { getLanguageExtension, }: { getLanguageExtension: typeof getLanguageExtensionFn; }) => Files; export const getDescriptionFile: (config: ContentConfig, user?: User, url?: string, gist?: boolean) => { [x: string]: { content: string; }; }; export const getCompilerScripts: ({ baseUrl, editorId, config, compiled, supportedLanguages, getLanguageCompiler, }: { baseUrl: string; editorId: EditorId; config: Config; compiled: { script: string; style: string; markup: string; }; supportedLanguages: { script: Language[]; style: Language[]; markup: Language[]; }; getLanguageCompiler: typeof getLanguageCompilerFn; }) => string[]; export const getContent: ({ editorId, config, compiled, supportedLanguages, getLanguageCompiler, }: { editorId: EditorId; config: Config; compiled: { script: string; style: string; markup: string; }; supportedLanguages: { script: Language[]; style: Language[]; markup: Language[]; }; getLanguageCompiler: typeof getLanguageCompilerFn; }) => string; } declare module "livecodes/deploy/deploy" { import type { getLanguageExtension as getLanguageExtensionFn } from "livecodes/languages/index"; import type { ContentConfig, User } from "livecodes/models"; import { type GitHubFile } from "livecodes/services/github"; export interface DeployResult { url: string; username: string; repo: string; tree: string; commit: string; } export const deploy: ({ user, repo, config, content, message, commitSource, singleFile, newRepo, deps, }: { user: User; repo: string; config: ContentConfig; content: { resultPage: string; style: string; script: string; }; message: string; commitSource: boolean; singleFile: boolean; newRepo: boolean; deps: { getLanguageExtension: typeof getLanguageExtensionFn; }; }) => Promise; export const deployFile: ({ file, user, repo, branch, message, description, readmeContent, }: { file: GitHubFile; user: User; repo: string; branch: string; message: string; description?: string; readmeContent?: string; }) => Promise; export const deployedConfirmation: (deployResult: DeployResult, sourcePublished: boolean) => HTMLDivElement; } declare module "livecodes/deploy/index" { export * from "livecodes/deploy/deploy"; } declare module "livecodes/editor/fake-editor" { import type { CodeEditor, EditorOptions } from "livecodes/models"; export const createFakeEditor: (options: EditorOptions) => CodeEditor; } declare module "livecodes/editor/fonts" { export interface Font { id: string; name: string; label?: string; url: string; } export const fonts: Font[]; export const getFontFamily: (font: string | undefined) => string; } declare module "livecodes/editor/create-editor" { import type { CodeEditor, Config, EditorOptions } from "livecodes/models"; export const createEditor: (options: EditorOptions & { activeEditor?: Config['activeEditor']; }) => Promise; } declare module "livecodes/editor/custom-editor-commands" { import type { EventsManager } from "livecodes/models"; export const registerEditorCommands: (enable: boolean, eventsManager: EventsManager) => void; } declare module "livecodes/editor/blockly/blockly" { import type { BlocklyContent, CustomEditorOptions, Theme } from "livecodes/models"; export const showBlockly: ({ baseUrl, editors, config, html, eventsManager, }: CustomEditorOptions) => Promise; export const getBlocklyContent: ({ baseUrl, editors, config, html, eventsManager, }: CustomEditorOptions) => Promise; export const setBlocklyTheme: (theme: Theme) => void; } declare module "livecodes/editor/blockly/blockly-editor" { import type { CustomEditor, EventsManager } from "livecodes/models"; export const createBlocklyEditor: ({ baseUrl, eventsManager, }: { baseUrl: string; eventsManager: EventsManager; }) => CustomEditor; } declare module "livecodes/editor/blockly/index" { export * from "livecodes/editor/blockly/blockly-editor"; } declare module "livecodes/editor/quill/quill" { import type { CustomEditorOptions, Theme } from "livecodes/models"; export const showQuillEditor: ({ baseUrl, config, editors, eventsManager, }: CustomEditorOptions) => Promise; export const getQuillEditorContent: ({ baseUrl, editors, config, html, eventsManager, }: CustomEditorOptions) => Promise<{ html?: string; }>; export const setQuillEditorTheme: (theme: Theme) => void; } declare module "livecodes/editor/quill/quill-editor" { import type { CustomEditor, EventsManager } from "livecodes/models"; export const createQuillEditor: ({ baseUrl, eventsManager, }: { baseUrl: string; eventsManager: EventsManager; }) => CustomEditor; } declare module "livecodes/editor/quill/index" { export * from "livecodes/editor/quill/quill-editor"; } declare module "livecodes/editor/custom-editors" { import type { CustomEditors, EventsManager } from "livecodes/models"; export const createCustomEditors: (options: { baseUrl: string; eventsManager: EventsManager; }) => CustomEditors; } declare module "livecodes/editor/index" { export * from "livecodes/editor/create-editor"; export * from "livecodes/editor/custom-editors"; export * from "livecodes/editor/fonts"; } declare module "livecodes/export/export-codepen" { import type { getLanguageCompiler as getLanguageCompilerFn, getLanguageExtension as getLanguageExtensionFn } from "livecodes/languages/index"; import type { Config, EditorId } from "livecodes/models"; export const exportCodepen: (config: Config, { baseUrl, compiled, deps, }: { baseUrl: string; compiled: { script: string; style: string; markup: string; }; deps: { getLanguageExtension: typeof getLanguageExtensionFn; getLanguageCompiler: typeof getLanguageCompilerFn; }; }) => void; } declare module "livecodes/export/export-github-gist" { import type { getLanguageExtension as getLanguageExtensionFn } from "livecodes/languages/index"; import type { Config, User } from "livecodes/models"; export const exportGithubGist: (config: Config, { user, deps, }: { user: User; deps: { getLanguageExtension: typeof getLanguageExtensionFn; }; }) => Promise; } declare module "livecodes/export/export-html" { import type { Config } from "livecodes/models"; export const exportHTML: (config: Config, html: string) => void; } declare module "livecodes/export/export-jsfiddle" { import type { getLanguageCompiler as getLanguageCompilerFn, getLanguageExtension as getLanguageExtensionFn } from "livecodes/languages/index"; import type { Config, EditorId } from "livecodes/models"; export const exportJsfiddle: (config: Config, { baseUrl, compiled, deps, }: { baseUrl: string; compiled: { script: string; style: string; markup: string; }; deps: { getLanguageExtension: typeof getLanguageExtensionFn; getLanguageCompiler: typeof getLanguageCompilerFn; }; }) => void; } declare module "livecodes/export/export-json" { import type { Config } from "livecodes/models"; export const exportJSON: (config: Config) => void; } declare module "livecodes/export/export-src" { import type { getLanguageExtension as getLanguageExtensionFn } from "livecodes/languages/index"; import type { Config } from "livecodes/models"; export const exportSrc: (config: Config, { html, deps, }: { html: string; deps: { getLanguageExtension: typeof getLanguageExtensionFn; }; }, _baseUrl?: string) => Promise; } declare module "livecodes/export/export" { import type { Config } from "livecodes/models"; export type ExportType = 'json' | 'src' | 'html' | 'codepen' | 'jsfiddle' | 'githubGist'; export const exportConfig: (config: Config, baseUrl: string, type: ExportType, payload?: any) => void; } declare module "livecodes/export/index" { export * from "livecodes/export/export"; export * from "livecodes/export/utils"; } declare module "livecodes/formatter/models" { import type { FormatFn, FormatterConfig, Language } from "livecodes/models"; export interface Formatter { load: (languages: Language[]) => Promise; getFormatFn: (language: Language) => Promise; destroy: () => void; } export interface FormatterMessageEvent extends MessageEvent { data: FormatterMessage; } export type FormatterMessage = InitMessage | LoadMessage | LoadedMessage | LoadFailedMessage | FormatMessage | FormattedMessage | FormatFailedMessage; export interface InitMessage { type: 'init'; baseUrl: string; } export interface LoadMessage { type: 'load'; payload: Language[]; } export interface LoadedMessage { type: 'loaded'; payload: Language[]; } export interface LoadFailedMessage { type: 'load-failed'; payload: Language[]; } export interface FormatMessage { type: 'format'; payload: { language: Language; value: string; cursorOffset: number; formatterConfig: Partial; }; } export interface FormattedMessage { type: 'formatted'; payload: { language: Language; value: string; cursorOffset: number; formatted: string; formattedCursorOffset: number; }; } export interface FormatFailedMessage { type: 'format-failed'; payload: { language: Language; value: string; cursorOffset: number; error: string; }; } } declare module "livecodes/formatter/formatter" { import type { Formatter } from "livecodes/formatter/models"; export const createFormatter: (baseUrl: string) => Formatter; } declare module "livecodes/formatter/get-formatter" { import type { Config } from "livecodes/models"; import type { Formatter } from "livecodes/formatter/models"; export const getFormatter: (config: Config, baseUrl: string, lazy: boolean) => Formatter; } declare module "livecodes/formatter/index" { export * from "livecodes/formatter/get-formatter"; } declare module "livecodes/import/check-src" { export const getValidUrl: (url: string) => URL | undefined; export const hostPatterns: { github: RegExp; githubGist: RegExp; gitlab: RegExp; codepen: RegExp; jsbin: RegExp; typescriptPlayground: RegExp; vuePlayground: RegExp; sveltePlayground: RegExp; }; export const isCompressedCode: (url: string) => boolean; export const isCodepen: (url: string, pattern?: RegExp) => boolean; export const isDom: (url: string) => boolean; export const isGithubUrl: (url: string, pattern?: RegExp) => boolean | undefined; export const isGithub: (url: string) => boolean | undefined; export const isGithubDir: (url: string, pattern?: RegExp) => boolean | undefined; export const isGithubGist: (url: string, pattern?: RegExp) => boolean; export const isGitlabUrl: (url: string, pattern?: RegExp) => boolean | undefined; export const isGitlabDir: (url: string, pattern?: RegExp) => boolean | undefined; export const isGitlabSnippet: (url: string, pattern?: RegExp) => boolean | undefined; export const isJsbin: (url: string, pattern?: RegExp) => boolean; export const isProjectId: (url: string) => boolean; export const isTypescriptPlayground: (url: string, pattern?: RegExp) => boolean; export const isVuePlayground: (url: string, pattern?: RegExp) => boolean; export const isSveltePlayground: (url: string, pattern?: RegExp) => boolean; } declare module "livecodes/import/code" { import type { Config } from "livecodes/models"; export const importCompressedCode: (url: string) => Partial; } declare module "livecodes/import/project-id" { export const importProject: (url: string) => Promise>; } declare module "livecodes/import/codepen" { import type { Config } from "livecodes/models"; export const importFromCodepen: (url: string) => Promise>; } declare module "livecodes/import/dom" { import type { Config, EditorId, Language } from "livecodes/models"; type Selectors = { [key in EditorId]: { language: Language; selector: string; }; }; export const getLanguageSelectors: (params: { [key: string]: string; }) => Partial; export const importFromDom: (html: string, params: { [key: string]: string; }, config: Config) => Promise>; } declare module "livecodes/import/github" { import type { Config, User } from "livecodes/models"; export const importFromGithub: (url: string, loggedInUser: User | null | void) => Promise>; export const addBaseTag: (config: Partial, files: Array<{ user: string; repo: string; ref: string; path: string; }>) => Partial; } declare module "livecodes/import/utils" { import type { Config, EditorId, Language } from "livecodes/models"; export interface SourceFile { filename: string; content: string; language?: Language; editorId?: EditorId; } export const populateConfig: (files: SourceFile[], params: { [key: string]: string; }) => Partial; } declare module "livecodes/import/github-dir" { import type { User } from "livecodes/models"; export const importFromGithubDir: (url: string, params: { [key: string]: string; }, loggedInUser: User | null | void) => Promise>; } declare module "livecodes/import/github-gist" { export const importFromGithubGist: (url: string, params: { [key: string]: string; }) => Promise<{}>; } declare module "livecodes/import/gitlab" { import type { Config, Language } from "livecodes/models"; export interface FileData { rawURL: string; filename: string; extension: Language; startLine: number; endLine: number; } export const importFromGitlab: (url: string) => Promise>; } declare module "livecodes/import/gitlab-dir" { export const importFromGitlabDir: (url: string, params: { [key: string]: string; }) => Promise>; } declare module "livecodes/import/gitlab-snippet" { export const importFromGitlabSnippet: (url: string, params: { [key: string]: string; }) => Promise<{}>; } declare module "livecodes/import/jsbin" { import type { Config } from "livecodes/models"; export const importFromJsbin: (url: string) => Promise>; } declare module "livecodes/import/typescript-playground" { import type { Config } from "livecodes/models"; export const importTypescriptPlayground: (url: string) => Promise>; } declare module "livecodes/import/zip" { import type { ContentConfig } from "livecodes/models"; import type { populateConfig as populateConfigFn } from "livecodes/import/utils"; export const importFromZip: (blob: Blob, populateConfig: typeof populateConfigFn) => Promise>; } declare module "livecodes/import/url" { import type { Config } from "livecodes/models"; export const importFromUrl: (url: string, params: { [key: string]: string; }, config: Config) => Promise>; } declare module "livecodes/import/vue-playground" { import type { Config } from "livecodes/models"; export const importVuePlayground: (url: string) => Promise>; } declare module "livecodes/import/import-src" { export { importFromCodepen } from "livecodes/import/codepen"; export { importFromDom } from "livecodes/import/dom"; export { importFromGithub } from "livecodes/import/github"; export { importFromGithubDir } from "livecodes/import/github-dir"; export { importFromGithubGist } from "livecodes/import/github-gist"; export { importFromGitlab } from "livecodes/import/gitlab"; export { importFromGitlabDir } from "livecodes/import/gitlab-dir"; export { importFromGitlabSnippet } from "livecodes/import/gitlab-snippet"; export { importFromJsbin } from "livecodes/import/jsbin"; export { importTypescriptPlayground } from "livecodes/import/typescript-playground"; export { importFromUrl } from "livecodes/import/url"; export { importVuePlayground } from "livecodes/import/vue-playground"; } declare module "livecodes/import/import" { import type { Config, User } from "livecodes/models"; export const importCode: (url: string, params: { [key: string]: any; }, config: Config, user: User | null | void, baseUrl: string) => Promise>; } declare module "livecodes/import/index" { export * from "livecodes/import/import"; } declare module "livecodes/languages/jsx/react-runtime" { export const reactRuntime = "\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nimport { createRoot } from \"react-dom/client\";\nimport App from \"./script\";\n(() => {\n if (typeof App !== \"function\") return;\n const root = createRoot(document.querySelector(\"#livecodes-app\") || document.body.appendChild(document.createElement(\"div\")));\n root.render(_jsx(App, {}));\n})();\n"; } declare module "livecodes/languages/react-native/react-native-runtime" { export const reactNativeRuntime = "\nimport { AppRegistry } from \"react-native\";\nimport App from \"./script\";\n(() => {\n if (typeof App !== \"function\") return;\n const rootTag = document.querySelector(\"#livecodes-app\") || document.body.appendChild(document.createElement(\"div\"));\n AppRegistry.registerComponent(\"App\", () => App);\n AppRegistry.runApplication(\"App\", { rootTag });\n})();\n"; } declare module "livecodes/languages/solid/solid-runtime" { export const solidRuntime = "\nimport { render, createComponent } from \"solid-js/web\";\nimport App from \"./script\";\n(() => {\n if (typeof App !== \"function\") return;\n const root = document.querySelector(\"#livecodes-app\") || document.body.appendChild(document.createElement(\"div\"));\n render(() => createComponent(App, {}), root);\n})();\n"; } declare module "livecodes/toolspane/test-imports" { export const testImports: { react: string; 'react/jsx-runtime': string; 'react-dom': string; 'react-dom/client': string; 'react-dom/test-utils': string; '@testing-library/dom': string; '@testing-library/jest-dom': string; '@testing-library/react': string; '@testing-library/react/pure': string; '@testing-library/user-event': string; chai: string; }; } declare module "livecodes/result/result-page" { import type { Cache, CompileInfo, Config } from "livecodes/models"; export const createResultPage: ({ code, config, forExport, template, baseUrl, singleFile, runTests, compileInfo, }: { code: Cache; config: Config; forExport: boolean; template: string; baseUrl: string; singleFile: boolean; runTests: boolean; compileInfo: CompileInfo; }) => Promise; export const cleanResultFromDev: (result: string) => string; } declare module "livecodes/result/utils" { export const typeOf: (obj: any) => string; export const proxyConsole: () => void; export const handleEval: () => void; export const handleResize: () => void; export const handleScrollPosition: () => void; } declare module "livecodes/result/index" { export * from "livecodes/result/result-page"; export * from "livecodes/result/utils"; } declare module "livecodes/templates/get-starter-templates" { import type { Config, Template } from "livecodes/models"; /** * get starter templates with languages that are enabled in the current config */ export const getStarterTemplates: (config: Config, baseUrl: string) => Promise; export const getTemplate: (name: string, config: Config, baseUrl: string) => Promise