formula-composer 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/README.md +122 -2
- package/angular/esm2020/formula-composer-tinymce-angular.mjs +4 -0
- package/angular/esm2020/lib/formula-composer.directive.mjs +52 -0
- package/angular/esm2020/lib/formula-composer.module.mjs +21 -0
- package/angular/esm2020/lib/init.mjs +9 -0
- package/angular/esm2020/lib/provide.mjs +11 -0
- package/angular/esm2020/public-api.mjs +8 -0
- package/angular/fesm2015/formula-composer-tinymce-angular.mjs +99 -0
- package/angular/fesm2020/formula-composer-tinymce-angular.mjs +101 -0
- package/angular/formula-composer-tinymce-angular.d.ts +5 -0
- package/angular/lib/formula-composer.directive.d.ts +22 -0
- package/angular/lib/formula-composer.module.d.ts +15 -0
- package/angular/lib/init.d.ts +23 -0
- package/angular/lib/provide.d.ts +10 -0
- package/angular/package.json +10 -0
- package/angular/public-api.d.ts +5 -0
- package/dist/editor-ui/catalog-types.d.ts +30 -0
- package/dist/editor-ui/catalog.generated.d.ts +2 -0
- package/dist/editor-ui/commands.d.ts +44 -0
- package/dist/editor-ui/dom.d.ts +8 -0
- package/dist/editor-ui/editor.d.ts +86 -0
- package/dist/editor-ui/icons.d.ts +5 -0
- package/dist/editor-ui/index.d.ts +9 -0
- package/dist/editor-ui/index.js +119 -0
- package/dist/editor-ui/modal.d.ts +81 -0
- package/dist/editor-ui/periodic.d.ts +8 -0
- package/dist/editor-ui/pickers.d.ts +23 -0
- package/dist/editor-ui/popover.d.ts +24 -0
- package/dist/editor-ui/special-chars.generated.d.ts +10 -0
- package/dist/editor-ui/strings.d.ts +48 -0
- package/dist/editor-ui/styles.d.ts +3 -0
- package/dist/editor-ui/toolbar.d.ts +47 -0
- package/dist/integration/content.d.ts +52 -0
- package/dist/integration/controller.d.ts +76 -0
- package/dist/integration/index.d.ts +3 -0
- package/dist/integration/index.js +1 -0
- package/dist/integration/options.d.ts +46 -0
- package/dist/math-core/a11y.d.ts +3 -0
- package/dist/math-core/caret-speech.d.ts +3 -0
- package/dist/math-core/editor.d.ts +212 -0
- package/dist/math-core/functions.d.ts +8 -0
- package/dist/math-core/history.d.ts +16 -0
- package/dist/math-core/index.d.ts +17 -0
- package/dist/math-core/index.js +3 -0
- package/dist/math-core/latex/parse.d.ts +11 -0
- package/dist/math-core/latex/serialize.d.ts +4 -0
- package/dist/math-core/latex/symbols.d.ts +32 -0
- package/dist/math-core/mathml.d.ts +33 -0
- package/dist/math-core/model.d.ts +69 -0
- package/dist/math-core/safe-xml.d.ts +7 -0
- package/dist/math-core/sanitize.d.ts +6 -0
- package/dist/math-core/tree-index.d.ts +26 -0
- package/dist/math-core/xml.d.ts +21 -0
- package/dist/renderer/alphanumerics.d.ts +3 -0
- package/dist/renderer/attributes.d.ts +10 -0
- package/dist/renderer/core.d.ts +13 -0
- package/dist/renderer/image.d.ts +29 -0
- package/dist/renderer/index.d.ts +22 -0
- package/dist/renderer/index.js +9 -0
- package/dist/renderer/layout.d.ts +14 -0
- package/dist/renderer/styles.d.ts +9 -0
- package/dist/renderer/view.d.ts +30 -0
- package/dist/renderer/vnode.d.ts +25 -0
- package/dist/tinymce/browser/plugin.min.js +129 -0
- package/dist/tinymce/compat.d.ts +24 -0
- package/dist/tinymce/index.d.ts +5 -0
- package/dist/tinymce/index.js +1 -0
- package/dist/tinymce/init.d.ts +22 -0
- package/dist/tinymce/plugin.d.ts +30 -0
- package/dist/tinymce/tinymce-types.d.ts +127 -0
- package/dist/tinymce-react/editor.d.ts +19 -0
- package/dist/tinymce-react/index.d.ts +3 -0
- package/dist/tinymce-react/index.js +1 -0
- package/dist/tinymce-react/init.d.ts +23 -0
- package/editor-ui/package.json +6 -0
- package/images/edit-formula.png +0 -0
- package/images/editor-content.png +0 -0
- package/integration/package.json +6 -0
- package/math-core/package.json +6 -0
- package/package.json +101 -4
- package/react/package.json +6 -0
- package/renderer/package.json +6 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type Attributes = Readonly<Record<string, string | undefined>>;
|
|
2
|
+
/** Creates an HTML element with attributes and children. `undefined` attributes are skipped. */
|
|
3
|
+
export declare function el<K extends keyof HTMLElementTagNameMap>(doc: Document, tag: K, attrs?: Attributes, children?: ReadonlyArray<Node | string>): HTMLElementTagNameMap[K];
|
|
4
|
+
export declare const SVG_NS = "http://www.w3.org/2000/svg";
|
|
5
|
+
/** Inline SVG icon from path data (original artwork, 16×16 grid). */
|
|
6
|
+
export declare function svgIcon(doc: Document, paths: readonly string[]): SVGSVGElement;
|
|
7
|
+
export declare function isMacPlatform(doc: Document): boolean;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { MathEditorModel, type MatrixKind } from '../math-core/index';
|
|
2
|
+
import type { TabId } from './catalog-types.js';
|
|
3
|
+
import type { EditorHost, NumeralMode } from './commands.js';
|
|
4
|
+
import { type EditorStrings, type StringOverrides } from './strings.js';
|
|
5
|
+
import { type ToolbarOptions } from './toolbar.js';
|
|
6
|
+
export interface MathEditorOptions extends ToolbarOptions {
|
|
7
|
+
language?: string;
|
|
8
|
+
strings?: StringOverrides;
|
|
9
|
+
/** CSS font size of the editing area. */
|
|
10
|
+
fontSize?: string;
|
|
11
|
+
/** Show the LaTeX source toggle. Default `true`. */
|
|
12
|
+
latexToggle?: boolean;
|
|
13
|
+
/** Show the keyboard-shortcut help button. Default `true`. */
|
|
14
|
+
help?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/** Formula editor widget: toolbar, editing area, keyboard, clipboard and accessibility. */
|
|
17
|
+
export declare class MathEditor implements EditorHost {
|
|
18
|
+
readonly element: HTMLDivElement;
|
|
19
|
+
readonly model: MathEditorModel;
|
|
20
|
+
readonly strings: EditorStrings;
|
|
21
|
+
private readonly doc;
|
|
22
|
+
private readonly toolbar;
|
|
23
|
+
private readonly view;
|
|
24
|
+
private readonly area;
|
|
25
|
+
private readonly input;
|
|
26
|
+
private readonly live;
|
|
27
|
+
private readonly latexArea;
|
|
28
|
+
private readonly latexStatus;
|
|
29
|
+
private readonly latexButton;
|
|
30
|
+
private readonly mac;
|
|
31
|
+
private readonly listeners;
|
|
32
|
+
private readonly unsubscribeModel;
|
|
33
|
+
private composing;
|
|
34
|
+
private dragging;
|
|
35
|
+
private latexMode;
|
|
36
|
+
private latexTimer;
|
|
37
|
+
private internalClipboard;
|
|
38
|
+
private initialMathML;
|
|
39
|
+
private numeralMode;
|
|
40
|
+
private destroyed;
|
|
41
|
+
constructor(container: HTMLElement, options?: MathEditorOptions);
|
|
42
|
+
getMathML(): string;
|
|
43
|
+
/** Loads MathML; throws `MathMLParseError` for malformed input. Resets the change baseline. */
|
|
44
|
+
setMathML(mathml: string): void;
|
|
45
|
+
/** Loads LaTeX; throws `LatexParseError` on unsupported input. */
|
|
46
|
+
setLatex(latex: string): void;
|
|
47
|
+
getLatex(): string;
|
|
48
|
+
isEmpty(): boolean;
|
|
49
|
+
/** True when the formula differs from the last {@link setMathML}. */
|
|
50
|
+
hasChanges(): boolean;
|
|
51
|
+
onChange(listener: () => void): () => void;
|
|
52
|
+
focus(): void;
|
|
53
|
+
selectTab(id: TabId): void;
|
|
54
|
+
get numerals(): NumeralMode;
|
|
55
|
+
setNumerals(mode: NumeralMode): void;
|
|
56
|
+
/** Re-measures the caret overlay (call after the container is resized or shown). */
|
|
57
|
+
relayout(): void;
|
|
58
|
+
get hasOpenPopup(): boolean;
|
|
59
|
+
closePopups(): void;
|
|
60
|
+
destroy(): void;
|
|
61
|
+
insertMathML(fragment: string): void;
|
|
62
|
+
copy(): void;
|
|
63
|
+
cut(): void;
|
|
64
|
+
paste(): void;
|
|
65
|
+
openColorPicker(anchor: HTMLElement): void;
|
|
66
|
+
openSpecialCharacters(anchor: HTMLElement): void;
|
|
67
|
+
openMatrixPicker(anchor: HTMLElement, kind: MatrixKind): void;
|
|
68
|
+
openValuePrompt(anchor: HTMLElement, label: string, initial: string, apply: (value: string) => void): void;
|
|
69
|
+
private onModelChange;
|
|
70
|
+
private announce;
|
|
71
|
+
private pasteInternal;
|
|
72
|
+
private writeSystemClipboard;
|
|
73
|
+
private mapNumerals;
|
|
74
|
+
private typeText;
|
|
75
|
+
private isCommand;
|
|
76
|
+
private bindInput;
|
|
77
|
+
private onClipboard;
|
|
78
|
+
private onKeyDown;
|
|
79
|
+
private onCommandKey;
|
|
80
|
+
private bindPointer;
|
|
81
|
+
get isLatexMode(): boolean;
|
|
82
|
+
setLatexMode(enabled: boolean): void;
|
|
83
|
+
/** Applies the LaTeX source to the model when it parses; keeps the last valid formula otherwise. */
|
|
84
|
+
private flushLatex;
|
|
85
|
+
private openHelp;
|
|
86
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ToolbarItem } from './catalog-types.js';
|
|
2
|
+
/** Draws a MathML fragment one script level smaller. */
|
|
3
|
+
export declare function compactIcon(mml: string): string;
|
|
4
|
+
/** MathML drawn for a toolbar item; differs from the inserted MathML only where the plain render is unreadable at icon size. */
|
|
5
|
+
export declare function iconMathML(item: ToolbarItem): string | undefined;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type { TabId, ToolbarItem, ToolbarItemKind, ToolbarSection, ToolbarTab } from './catalog-types.js';
|
|
2
|
+
export { TOOLBAR_CATALOG } from './catalog.generated.js';
|
|
3
|
+
export { ACTIONS, SELECTS, UNSUPPORTED_ACTIONS, type ActionSpec, type EditorHost, type NumeralMode, type SelectSpec } from './commands.js';
|
|
4
|
+
export { MathEditor, type MathEditorOptions } from './editor.js';
|
|
5
|
+
export { FULLSCREEN_MAX, MINIMIZED_SIZE, MathModal, type MathModalOptions, type ModalState, type OpenOptions, STACK_SIZE } from './modal.js';
|
|
6
|
+
export { COLOR_PALETTE, codeToCharacter, normalizeHex } from './pickers.js';
|
|
7
|
+
export { type EditorStrings, SUPPORTED_LANGUAGES, type StringOverrides, getStrings, isRtlLanguage, normalizeLanguage } from './strings.js';
|
|
8
|
+
export { EDITOR_CSS, ensureEditorStyles } from './styles.js';
|
|
9
|
+
export { Toolbar, type ToolbarOptions } from './toolbar.js';
|