@minamorl/flashmath 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.
Files changed (89) hide show
  1. package/LICENSE +225 -0
  2. package/NOTICE +25 -0
  3. package/README.md +188 -2
  4. package/dist/ast.d.ts +107 -0
  5. package/dist/chunk-2BLNXHV2.js +1 -0
  6. package/dist/chunk-BCYDUHHK.js +1 -0
  7. package/dist/chunk-IHTB7IDO.js +1 -0
  8. package/dist/chunk-KDAOMSCC.js +1 -0
  9. package/dist/chunk-TXV67IQS.js +1 -0
  10. package/dist/chunk-WZSFAGJH.js +1 -0
  11. package/dist/chunk-X6BR56FI.js +1 -0
  12. package/dist/configuration-cache.d.ts +4 -0
  13. package/dist/configuration-cache.js +1 -0
  14. package/dist/configuration.d.ts +13 -0
  15. package/dist/configuration.js +1 -0
  16. package/dist/fonts/mjx-ncm-c.woff2 +0 -0
  17. package/dist/fonts/mjx-ncm-cb.woff2 +0 -0
  18. package/dist/fonts/mjx-ncm-s.woff2 +0 -0
  19. package/dist/fonts/mjx-ncm-sb.woff2 +0 -0
  20. package/dist/fonts/provenance.json +24 -0
  21. package/dist/fonts.css +29 -0
  22. package/dist/index.d.ts +6 -0
  23. package/dist/index.js +1 -0
  24. package/dist/mathml.d.ts +18 -0
  25. package/dist/native-layout.d.ts +7 -0
  26. package/dist/native-variants.d.ts +2 -0
  27. package/dist/native-variants.js +1 -0
  28. package/dist/output.d.ts +4 -0
  29. package/dist/output.js +1 -0
  30. package/dist/package-mark.d.ts +5 -0
  31. package/dist/packages/action.d.ts +17 -0
  32. package/dist/packages/ams.d.ts +19 -0
  33. package/dist/packages/amscd.d.ts +30 -0
  34. package/dist/packages/autoload.d.ts +16 -0
  35. package/dist/packages/base.d.ts +22 -0
  36. package/dist/packages/bbm.d.ts +24 -0
  37. package/dist/packages/bboldx.d.ts +12 -0
  38. package/dist/packages/bbox.d.ts +11 -0
  39. package/dist/packages/begingroup.d.ts +9 -0
  40. package/dist/packages/boldsymbol.d.ts +11 -0
  41. package/dist/packages/braket.d.ts +9 -0
  42. package/dist/packages/bussproofs-layout.d.ts +5 -0
  43. package/dist/packages/bussproofs-metrics.d.ts +1 -0
  44. package/dist/packages/bussproofs.d.ts +13 -0
  45. package/dist/packages/cancel.d.ts +8 -0
  46. package/dist/packages/cases.d.ts +16 -0
  47. package/dist/packages/centernot.d.ts +15 -0
  48. package/dist/packages/color.d.ts +30 -0
  49. package/dist/packages/colortbl.d.ts +10 -0
  50. package/dist/packages/colorv2.d.ts +15 -0
  51. package/dist/packages/configmacros.d.ts +11 -0
  52. package/dist/packages/dsfont.d.ts +12 -0
  53. package/dist/packages/empheq.d.ts +17 -0
  54. package/dist/packages/enclose.d.ts +13 -0
  55. package/dist/packages/extpfeil.d.ts +10 -0
  56. package/dist/packages/fontsizev3.d.ts +11 -0
  57. package/dist/packages/gensymb.d.ts +11 -0
  58. package/dist/packages/html.d.ts +8 -0
  59. package/dist/packages/mathtools.d.ts +17 -0
  60. package/dist/packages/mhchem-grammar.d.ts +179 -0
  61. package/dist/packages/mhchem-machine.d.ts +50 -0
  62. package/dist/packages/mhchem.d.ts +8 -0
  63. package/dist/packages/newcommand.d.ts +13 -0
  64. package/dist/packages/noerrors.d.ts +23 -0
  65. package/dist/packages/noundefined.d.ts +9 -0
  66. package/dist/packages/physics.d.ts +14 -0
  67. package/dist/packages/registry.d.ts +4 -0
  68. package/dist/packages/registry.js +1 -0
  69. package/dist/packages/require.d.ts +17 -0
  70. package/dist/packages/retry.d.ts +11 -0
  71. package/dist/packages/setoptions.d.ts +20 -0
  72. package/dist/packages/tagformat.d.ts +19 -0
  73. package/dist/packages/texhtml.d.ts +14 -0
  74. package/dist/packages/textcomp.d.ts +13 -0
  75. package/dist/packages/textmacros.d.ts +16 -0
  76. package/dist/packages/types.d.ts +47 -0
  77. package/dist/packages/unicode.d.ts +18 -0
  78. package/dist/packages/units.d.ts +19 -0
  79. package/dist/packages/upgreek.d.ts +11 -0
  80. package/dist/packages/verb.d.ts +11 -0
  81. package/dist/parser.d.ts +149 -0
  82. package/dist/preamble.d.ts +23 -0
  83. package/dist/react.d.ts +5 -0
  84. package/dist/react.js +1 -0
  85. package/dist/scanner.d.ts +40 -0
  86. package/dist/serialize.d.ts +3 -0
  87. package/dist/session-state.d.ts +18 -0
  88. package/dist/symbols.d.ts +544 -0
  89. package/package.json +56 -4
@@ -0,0 +1,179 @@
1
+ export declare const enum Pattern {
2
+ Empty = 0,
3
+ Any = 1,
4
+ Any2 = 2,
5
+ Space = 3,
6
+ SpaceA = 4,
7
+ SpaceEnd = 5,
8
+ Lower = 6,
9
+ X = 7,
10
+ XEnd = 8,
11
+ IEnd = 9,
12
+ Letters = 10,
13
+ Greek = 11,
14
+ LatinEnd = 12,
15
+ MathLatinEnd = 13,
16
+ GreekEnd = 14,
17
+ Digits = 15,
18
+ Number = 16,
19
+ NumberFull = 17,
20
+ Scientific = 18,
21
+ PowerNumber = 19,
22
+ StateEnd = 20,
23
+ StateSub = 21,
24
+ Open = 22,
25
+ Close = 23,
26
+ CommaSpace = 24,
27
+ Comma = 25,
28
+ Dot = 26,
29
+ Hydrate = 27,
30
+ Ellipsis = 28,
31
+ TopGroup = 29,
32
+ TopMath = 30,
33
+ TopChar = 31,
34
+ TopCommandTwo = 32,
35
+ TopCommandOne = 33,
36
+ TopCommand = 34,
37
+ TopInteger = 35,
38
+ Prime = 36,
39
+ SubGroup = 37,
40
+ SubMath = 38,
41
+ SubChar = 39,
42
+ SubCommandTwo = 40,
43
+ SubCommandOne = 41,
44
+ SubCommand = 42,
45
+ EmptyScript = 43,
46
+ EmptyTop = 44,
47
+ EmptyGroup = 45,
48
+ GroupRaw = 46,
49
+ Group = 47,
50
+ MathRaw = 48,
51
+ Math = 49,
52
+ Bond = 50,
53
+ TripleBond = 51,
54
+ Plus = 52,
55
+ ChargeMinus = 53,
56
+ Negative = 54,
57
+ OrbitalMinus = 55,
58
+ Minus = 56,
59
+ PlusMinus = 57,
60
+ Operator = 58,
61
+ Phase = 59,
62
+ ExplicitBond = 60,
63
+ Arrow = 61,
64
+ LabelMode = 62,
65
+ Label = 63,
66
+ Escape = 64,
67
+ Spacer = 65,
68
+ CommandTwo = 66,
69
+ CommandOne = 67,
70
+ Circa = 68,
71
+ Command = 69,
72
+ Orbital = 70,
73
+ Other = 71,
74
+ Fraction = 72,
75
+ Overset = 73,
76
+ Underset = 74,
77
+ Underbrace = 75,
78
+ Color = 76,
79
+ ColorBody = 77,
80
+ Ce = 78,
81
+ Pu = 79,
82
+ SignedOxidation = 80,
83
+ Oxidation = 81,
84
+ FractionEnd = 82,
85
+ Amount = 83,
86
+ Amount2 = 84,
87
+ DefectLetters = 85,
88
+ FormulaEnd = 86,
89
+ Upright = 87,
90
+ Slash = 88,
91
+ DoubleSlash = 89,
92
+ Product = 90
93
+ }
94
+ export declare const enum Action {
95
+ Copy = 0,
96
+ Write = 1,
97
+ Ce = 2,
98
+ Pu = 3,
99
+ Output = 4,
100
+ NotBond = 5,
101
+ OxidationOutput = 6,
102
+ NoSpace = 7,
103
+ Operator = 8,
104
+ SetO = 9,
105
+ SetR = 10,
106
+ SetA = 11,
107
+ BeginsBond = 12,
108
+ Bond = 13,
109
+ SpaceBefore = 14,
110
+ InsertValue = 15,
111
+ Insert = 16,
112
+ State = 17,
113
+ Open = 18,
114
+ Close = 19,
115
+ Comma = 20,
116
+ SetB = 21,
117
+ SetP = 22,
118
+ Fraction = 23,
119
+ Overset = 24,
120
+ Underset = 25,
121
+ Underbrace = 26,
122
+ Color = 27,
123
+ Color0 = 28,
124
+ SetDefect = 29,
125
+ SetQ = 30,
126
+ TopMode = 31,
127
+ Top = 32,
128
+ BottomMode = 33,
129
+ Bottom = 34,
130
+ AmountToBody = 35,
131
+ ChargeOrBond = 36,
132
+ MinusAfter = 37,
133
+ SetD = 38,
134
+ BodyAfter = 39,
135
+ AmountFraction = 40,
136
+ MathTight = 41,
137
+ Roman = 42,
138
+ Math = 43,
139
+ Text = 44,
140
+ SetText = 45,
141
+ Decimal = 46,
142
+ RomanNumeral = 47,
143
+ AppendO = 48,
144
+ TightOperator = 49,
145
+ Space = 50,
146
+ NumberPower = 51,
147
+ Scientific = 52,
148
+ Dot = 53,
149
+ SetRoman = 54,
150
+ UnitPower = 55,
151
+ IntegerOutput = 56,
152
+ DecimalOutput = 57
153
+ }
154
+ export declare const enum Machine {
155
+ TeX = 0,
156
+ Ce = 1,
157
+ Amount = 2,
158
+ Body = 3,
159
+ Text = 4,
160
+ Sub = 5,
161
+ Sup = 6,
162
+ Oxidation = 7,
163
+ Math = 8,
164
+ MathTight = 9,
165
+ Decimal = 10,
166
+ Pu = 11,
167
+ Unit = 12,
168
+ UnitNumber = 13
169
+ }
170
+ export type Option = string | number | boolean | null;
171
+ export type Rule = readonly [Pattern, readonly (readonly [Action, Option])[], number, number];
172
+ export interface Grammar {
173
+ name: string;
174
+ names: readonly string[];
175
+ states: readonly (readonly number[])[];
176
+ rules: readonly Rule[];
177
+ start: number;
178
+ }
179
+ export declare function chemistryGrammar(): readonly Grammar[];
@@ -0,0 +1,50 @@
1
+ import { Machine as M } from './mhchem-grammar.js';
2
+ type SourceIndex = {
3
+ braces?: Map<number, number>;
4
+ };
5
+ type Piece = {
6
+ source: string;
7
+ start: number;
8
+ end: number;
9
+ index?: SourceIndex;
10
+ };
11
+ type Text = readonly Piece[];
12
+ export declare class View {
13
+ readonly parts: Text;
14
+ readonly offsets: number[];
15
+ readonly length: number;
16
+ constructor(parts: Text);
17
+ c(i: number): number;
18
+ at(s: string, i?: number): boolean;
19
+ equal(s: string): boolean;
20
+ span(a: number, b?: number): Text;
21
+ emit(a?: number, b?: number): string;
22
+ skip(i: number): number;
23
+ command(i: number): number;
24
+ group(i: number, open?: number, close?: number): number;
25
+ number(i: number, sign?: boolean, missingZero?: boolean): number;
26
+ integer(i: number, sign?: boolean): number;
27
+ greek(i: number, onlyLower?: boolean): number;
28
+ letters(i: number): number;
29
+ boundary(i: number): boolean;
30
+ orbital(i: number): number;
31
+ state(i: number): number;
32
+ fraction(i: number): number;
33
+ formula(i: number): boolean;
34
+ amount(i: number): number;
35
+ }
36
+ interface Item {
37
+ tex: string;
38
+ escape?: boolean;
39
+ children?: Item[];
40
+ count?: number;
41
+ }
42
+ export declare class MhchemMachine {
43
+ readonly fail: (message: string) => never;
44
+ readonly maxDepth: number;
45
+ constructor(fail: (message: string) => never, maxDepth?: number);
46
+ run(text: Text, machine: M): Item[];
47
+ private steps;
48
+ toTex(source: string, unit?: boolean): string;
49
+ }
50
+ export {};
@@ -0,0 +1,8 @@
1
+ import type { TexCommand } from './types.js';
2
+ declare const _default: {
3
+ name: string;
4
+ commands: Record<string, TexCommand>;
5
+ environments: {};
6
+ configurationModules: string[];
7
+ };
8
+ export default _default;
@@ -0,0 +1,13 @@
1
+ import type { Parser } from "../parser.js";
2
+ import type { Token } from "../scanner.js";
3
+ declare const _default: {
4
+ name: string;
5
+ commands: {
6
+ [k: string]: {
7
+ execute: (p: Parser, _t: Token, _d: unknown, id: number) => void;
8
+ };
9
+ };
10
+ environments: {};
11
+ configurationModules: string[];
12
+ };
13
+ export default _default;
@@ -0,0 +1,23 @@
1
+ declare const _default: {
2
+ name: string;
3
+ commands: {};
4
+ environments: {};
5
+ configurationModules: string[];
6
+ formatError(message: string, tex: string): {
7
+ kind: "merror";
8
+ attributes: {
9
+ 'data-mjx-error': string;
10
+ title: string;
11
+ };
12
+ text: string;
13
+ start: number;
14
+ children: {
15
+ kind: "mtext";
16
+ attributes: {};
17
+ children: never[];
18
+ text: string;
19
+ start: number;
20
+ }[];
21
+ };
22
+ };
23
+ export default _default;
@@ -0,0 +1,9 @@
1
+ declare const _default: {
2
+ name: string;
3
+ commands: {};
4
+ environments: {};
5
+ options: string[];
6
+ configurationModules: string[];
7
+ undefinedCommand(p: import("../parser.js").Parser, name: string): void;
8
+ };
9
+ export default _default;
@@ -0,0 +1,14 @@
1
+ import type { Parser } from '../parser.js';
2
+ import type { TexCommand } from './types.js';
3
+ declare const _default: {
4
+ name: string;
5
+ commands: Record<string, TexCommand>;
6
+ environments: {
7
+ smallmatrix: {
8
+ begin(p: Parser, name: string): void;
9
+ };
10
+ };
11
+ options: string[];
12
+ configurationModules: string[];
13
+ };
14
+ export default _default;
@@ -0,0 +1,4 @@
1
+ import type { PackageEntry, TexPackage, PackageConfiguration } from './types.js';
2
+ export declare const registeredPackages: readonly TexPackage[];
3
+ export declare function resolvePackages(entries?: readonly PackageEntry[]): PackageConfiguration;
4
+ export declare function validateConfigurationModules(names?: readonly string[]): void;
@@ -0,0 +1 @@
1
+ import{H as a,I as b,J as c,K as d}from"../chunk-X6BR56FI.js";import"../chunk-IHTB7IDO.js";import"../chunk-KDAOMSCC.js";import"../chunk-WZSFAGJH.js";d();export{a as registeredPackages,b as resolvePackages,c as validateConfigurationModules};
@@ -0,0 +1,17 @@
1
+ import type { Parser } from '../parser.js';
2
+ export declare function loadPackage(p: Parser, name: string): void;
3
+ export declare function requirePackage(p: Parser): void;
4
+ export declare function initializeRequire(p: Parser): void;
5
+ declare const _default: {
6
+ name: string;
7
+ commands: {
8
+ require: {
9
+ execute: typeof requirePackage;
10
+ };
11
+ };
12
+ environments: {};
13
+ options: string[];
14
+ configurationModules: string[];
15
+ initialize: typeof initializeRequire;
16
+ };
17
+ export default _default;
@@ -0,0 +1,11 @@
1
+ /** Harness compatibility: a synchronous parse never needs the upstream loader retry. */
2
+ declare const _default: {
3
+ name: string;
4
+ commands: {
5
+ retry: {
6
+ execute(): void;
7
+ };
8
+ };
9
+ environments: {};
10
+ };
11
+ export default _default;
@@ -0,0 +1,20 @@
1
+ import type { Parser } from '../parser.js';
2
+ import { requirePackage } from './require.js';
3
+ export declare function setOptions(p: Parser): void;
4
+ declare const _default: {
5
+ name: string;
6
+ priority: number;
7
+ commands: {
8
+ setOptions: {
9
+ execute: typeof setOptions;
10
+ };
11
+ Require: {
12
+ execute: typeof requirePackage;
13
+ };
14
+ };
15
+ initialize(p: Parser): void;
16
+ environments: {};
17
+ options: string[];
18
+ configurationModules: string[];
19
+ };
20
+ export default _default;
@@ -0,0 +1,19 @@
1
+ import type { Parser } from '../parser.js';
2
+ type Result = string | string[];
3
+ type Key = 'number' | 'tag' | 'ref' | 'id' | 'url';
4
+ export declare function format(p: Parser, key: Key, ...args: (string | number)[]): Result;
5
+ export declare function tagNodes(p: Parser, tag: string, starred?: boolean, ref?: boolean): import("../ast.js").Node[];
6
+ declare const _default: {
7
+ name: string;
8
+ priority: number;
9
+ commands: {
10
+ tag: import("./types.js").TexCommand;
11
+ eqref: {
12
+ execute(p: Parser): void;
13
+ };
14
+ };
15
+ environments: {};
16
+ options: string[];
17
+ configurationModules: string[];
18
+ };
19
+ export default _default;
@@ -0,0 +1,14 @@
1
+ import type { Parser } from '../parser.js';
2
+ declare const _default: {
3
+ name: string;
4
+ commands: {
5
+ '<': {
6
+ type: string;
7
+ execute(p: Parser, t: import("../scanner.js").Token): void;
8
+ };
9
+ };
10
+ environments: {};
11
+ options: string[];
12
+ configurationModules: string[];
13
+ };
14
+ export default _default;
@@ -0,0 +1,13 @@
1
+ export declare const textcompSymbols: Record<string, [string, string]>;
2
+ declare const _default: {
3
+ name: string;
4
+ commands: {
5
+ [k: string]: {
6
+ type: string;
7
+ execute(p: import("../parser.js").Parser): void;
8
+ };
9
+ };
10
+ environments: {};
11
+ configurationModules: string[];
12
+ };
13
+ export default _default;
@@ -0,0 +1,16 @@
1
+ import type { Node } from '../ast.js';
2
+ import type { Parser } from '../parser.js';
3
+ import type { Token, TokenSpan } from '../scanner.js';
4
+ import type { TexCommand } from './types.js';
5
+ /** Text has its own token grammar and scope stack; mathematical subexpressions
6
+ * return to the existing explicit math stack rather than reparsing the suffix. */
7
+ export declare function renderTextMacros(p: Parser, tokens: readonly Token[] | TokenSpan, font?: string, style?: boolean, done?: (n: Node) => void): void;
8
+ declare const _default: {
9
+ name: string;
10
+ priority: number;
11
+ commands: Record<string, TexCommand>;
12
+ environments: {};
13
+ options: string[];
14
+ configurationModules: string[];
15
+ };
16
+ export default _default;
@@ -0,0 +1,47 @@
1
+ import type { MathMLNode } from "../ast.js";
2
+ import type { Parser } from "../parser.js";
3
+ import type { Token } from "../scanner.js";
4
+ import type { Definition } from "../symbols.js";
5
+ export type PackageEntry = string | readonly [name: string, priority: number];
6
+ export type CommandHandler = (parser: Parser, token: Token, definition: Definition, id: number) => void | boolean;
7
+ export interface TexCommand {
8
+ type?: string;
9
+ char?: string;
10
+ attrs?: Record<string, unknown>;
11
+ args?: unknown[];
12
+ execute: CommandHandler;
13
+ }
14
+ export interface TexEnvironment {
15
+ begin: (parser: Parser, name: string) => void;
16
+ end?: (parser: Parser, name: string) => void;
17
+ }
18
+ export interface TexPackage {
19
+ name: string;
20
+ initialize?: (parser: Parser) => void;
21
+ undefinedCommand?: (parser: Parser, name: string) => void;
22
+ formatError?: (message: string, tex: string) => MathMLNode;
23
+ priority?: number;
24
+ commands: Readonly<Record<string, TexCommand>>;
25
+ characters?: Readonly<Record<string, TexCommand>>;
26
+ environments: Readonly<Record<string, TexEnvironment>>;
27
+ configurationModules?: readonly string[];
28
+ options?: readonly string[];
29
+ }
30
+ export interface RegisteredCommand {
31
+ definition: Definition;
32
+ execute: CommandHandler;
33
+ id: number;
34
+ }
35
+ export interface ActivePackageConfiguration extends PackageConfiguration {
36
+ entries: readonly PackageEntry[];
37
+ packages: readonly TexPackage[];
38
+ }
39
+ export interface PackageConfiguration {
40
+ characterHandlers: ReadonlyMap<number, readonly RegisteredCommand[]>;
41
+ initializers: readonly ((parser: Parser) => void)[];
42
+ characters: ReadonlyMap<string, RegisteredCommand>;
43
+ commands: readonly (RegisteredCommand | undefined)[];
44
+ extensions: ReadonlyMap<string, RegisteredCommand>;
45
+ environments: ReadonlyMap<string, TexEnvironment>;
46
+ options: ReadonlySet<string>;
47
+ }
@@ -0,0 +1,18 @@
1
+ import type { Parser } from '../parser.js';
2
+ declare const _default: {
3
+ name: string;
4
+ commands: {
5
+ unicode: {
6
+ execute(p: Parser): void;
7
+ };
8
+ U: {
9
+ execute(p: Parser): void;
10
+ };
11
+ char: {
12
+ execute(p: Parser): void;
13
+ };
14
+ };
15
+ environments: {};
16
+ configurationModules: string[];
17
+ };
18
+ export default _default;
@@ -0,0 +1,19 @@
1
+ import type { Parser } from '../parser.js';
2
+ declare const _default: {
3
+ name: string;
4
+ commands: {
5
+ units: {
6
+ execute(p: Parser): void;
7
+ };
8
+ unitfrac: {
9
+ execute(p: Parser): void;
10
+ };
11
+ nicefrac: {
12
+ execute(p: Parser): void;
13
+ };
14
+ };
15
+ environments: {};
16
+ options: string[];
17
+ configurationModules: string[];
18
+ };
19
+ export default _default;
@@ -0,0 +1,11 @@
1
+ declare const _default: {
2
+ name: string;
3
+ commands: {
4
+ [k: string]: {
5
+ execute(p: import("../parser.js").Parser): void;
6
+ };
7
+ };
8
+ environments: {};
9
+ configurationModules: string[];
10
+ };
11
+ export default _default;
@@ -0,0 +1,11 @@
1
+ declare const _default: {
2
+ name: string;
3
+ commands: {
4
+ verb: {
5
+ execute(p: import("../parser.js").Parser): void;
6
+ };
7
+ };
8
+ environments: {};
9
+ configurationModules: string[];
10
+ };
11
+ export default _default;