UNPKG

3.22 kBTypeScriptView Raw
1import { Token } from '@lumino/coreutils';
2import { CommandRegistry } from '@lumino/commands';
3import { ICommandPalette } from '@jupyterlab/apputils';
4import { ISignal } from '@lumino/signaling';
5import { INotebookTracker, NotebookPanel } from '@jupyterlab/notebook';
6import { Menu } from '@lumino/widgets';
7import * as SCHEMA from './schema';
8import '../style/index.css';
9export declare type Scope = 'global' | 'notebook';
10export declare enum TextKind {
11 code = "code",
12 content = "content"
13}
14export declare const KIND_LABELS: {
15 [key in TextKind]: string;
16};
17export declare enum FontFormat {
18 woff2 = "woff2",
19 woff = "woff"
20}
21export declare type TFontMimeTypes = {
22 [key in FontFormat]: string;
23};
24export declare const FONT_FORMATS: {
25 woff2: string;
26 woff: string;
27};
28export declare type TextProperty = 'font-family' | 'font-size' | 'line-height';
29export interface IFontCallback {
30 (): Promise<SCHEMA.IFontFacePrimitive[]>;
31}
32export interface IFontLicense {
33 name: string;
34 spdx: string;
35 text: () => Promise<string>;
36 holders: string[];
37}
38export interface IFontFaceOptions {
39 name: string;
40 faces: IFontCallback;
41 license: IFontLicense;
42}
43export declare const CMD: {
44 code: {
45 fontSize: string;
46 fontFamily: string;
47 lineHeight: string;
48 };
49 content: {
50 fontSize: string;
51 fontFamily: string;
52 lineHeight: string;
53 };
54 editFonts: string;
55 customFonts: {
56 disable: string;
57 enable: string;
58 };
59};
60export declare const ROOT = ":root";
61export declare type ICSSVars = {
62 [key in TextKind]: {
63 [key in TextProperty]: SCHEMA.ICSSOM;
64 };
65};
66export declare const CSS: ICSSVars;
67export declare type ICSSTextOptions = {
68 [key in TextProperty]: (manager: IFontManager) => SCHEMA.ICSSOM[];
69};
70export declare const TEXT_OPTIONS: ICSSTextOptions;
71export declare type ICSSTextLabels = {
72 [key in TextProperty]: string;
73};
74export declare const TEXT_LABELS: ICSSTextLabels;
75export declare const DEFAULT: {
76 code: {
77 fontSize: string;
78 lineHeight: string;
79 fontFamily: string;
80 };
81};
82export declare const PACKAGE_NAME: string;
83export declare const CONFIGURED_CLASS = "jp-fonts-configured";
84export declare const IFontManager: Token<IFontManager>;
85export interface IFontManagerConstructor {
86 new (commands: CommandRegistry, palette: ICommandPalette, notebooks: INotebookTracker): IFontManager;
87}
88export interface IFontManager {
89 ready: Promise<void>;
90 registerFontFace(options: IFontFaceOptions): void;
91 licensePaneRequested: ISignal<IFontManager, any>;
92 requestLicensePane(font: any): void;
93 fonts: Map<string, IFontFaceOptions>;
94 stylesheets: HTMLStyleElement[];
95 menu: Menu;
96 getVarName(property: TextProperty, options: ITextStyleOptions): SCHEMA.ICSSOM | null;
97 getTextStyle(property: TextProperty, options: ITextStyleOptions): SCHEMA.ICSSOM | null;
98 setTextStyle(property: TextProperty, value: SCHEMA.ICSSOM | null, options: ITextStyleOptions): void;
99 dataURISrc(url: string, format: FontFormat): Promise<string>;
100}
101export interface ITextStyleOptions {
102 kind: TextKind;
103 scope?: Scope;
104 notebook?: NotebookPanel;
105}