mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00

The API extractor integration isn't set up properly yet, so I had to manually generate the d.ts bundle and copy it into the add-on: cd ts/runtime bazel run extract_api cp ../../.bazel/bin/ts/runtime/extract_api.sh.runfiles/ankidesktop/ts/runtime/dist/anki.d.ts \ $c/anki_new_format_pack/ts/anki-dts/runtime.d.ts
31 lines
961 B
TypeScript
31 lines
961 B
TypeScript
// Copyright: Ankitects Pty Ltd and contributors
|
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|
|
|
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
|
|
import IconButton from "../components/IconButton.svelte";
|
|
import WithState from "../components/WithState.svelte";
|
|
import type { NoteEditorPackage } from "../editor/NoteEditor.svelte";
|
|
import { registerPackage } from "../lib/runtime-require";
|
|
|
|
// The typed version from runtime-require will need adjusting if we go
|
|
// down this route; for now just use an untyped version.
|
|
declare function require(text: string): unknown;
|
|
|
|
/**
|
|
* Exports from the editing screen. Only available on pages that show an editor.
|
|
*/
|
|
export const editor = require("anki/NoteEditor") as NoteEditorPackage;
|
|
|
|
/**
|
|
* Basic Svelte UI components. Available on all pages.
|
|
*/
|
|
export const components = {
|
|
IconButton,
|
|
WithState,
|
|
};
|
|
|
|
registerPackage("anki/runtime", {
|
|
editor,
|
|
components,
|
|
});
|