math-notation 0.1.0 → 0.1.1
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/dist/formulize.cjs.js +46 -39
- package/dist/formulize.cjs.js.map +1 -1
- package/dist/formulize.es.js +46 -39
- package/dist/formulize.es.js.map +1 -1
- package/dist/formulize.umd.js +46 -39
- package/dist/formulize.umd.js.map +1 -1
- package/dist/style.css +4 -4
- package/dist/types/index.d.ts +50 -50
- package/package.json +1 -1
package/dist/style.css
CHANGED
|
@@ -1238,14 +1238,14 @@ html,
|
|
|
1238
1238
|
}
|
|
1239
1239
|
|
|
1240
1240
|
.var-scale-wrapper.active {
|
|
1241
|
-
animation:
|
|
1241
|
+
animation: scale-in 0.2s ease-out forwards;
|
|
1242
1242
|
}
|
|
1243
1243
|
|
|
1244
1244
|
.var-scale-wrapper.scale-out {
|
|
1245
|
-
animation:
|
|
1245
|
+
animation: scale-out 0.2s ease-out forwards;
|
|
1246
1246
|
}
|
|
1247
1247
|
|
|
1248
|
-
@keyframes
|
|
1248
|
+
@keyframes scale-in {
|
|
1249
1249
|
from {
|
|
1250
1250
|
transform: scale(1);
|
|
1251
1251
|
}
|
|
@@ -1254,7 +1254,7 @@ html,
|
|
|
1254
1254
|
}
|
|
1255
1255
|
}
|
|
1256
1256
|
|
|
1257
|
-
@keyframes
|
|
1257
|
+
@keyframes scale-out {
|
|
1258
1258
|
from {
|
|
1259
1259
|
transform: scale(1.1);
|
|
1260
1260
|
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -614,6 +614,11 @@ export declare class ComputationStore {
|
|
|
614
614
|
getVariables(): Record<string, IVariable>;
|
|
615
615
|
}
|
|
616
616
|
|
|
617
|
+
/**
|
|
618
|
+
* User-facing configuration type.
|
|
619
|
+
*/
|
|
620
|
+
export declare type Config = IEnvironment;
|
|
621
|
+
|
|
617
622
|
declare type ContentChange = {
|
|
618
623
|
type: "delete";
|
|
619
624
|
from: number;
|
|
@@ -628,11 +633,11 @@ declare type ContentChange = {
|
|
|
628
633
|
/**
|
|
629
634
|
* Public API - creates a new Formulize instance with its own isolated stores.
|
|
630
635
|
*/
|
|
631
|
-
declare function create(config:
|
|
636
|
+
declare function create(config: Config): Promise<Instance>;
|
|
632
637
|
|
|
633
638
|
/**
|
|
634
639
|
* Factory function to create a new ComputationStore instance.
|
|
635
|
-
* Used for creating scoped stores per
|
|
640
|
+
* Used for creating scoped stores per Provider.
|
|
636
641
|
*/
|
|
637
642
|
export declare function createComputationStore(): ComputationStore;
|
|
638
643
|
|
|
@@ -780,46 +785,6 @@ declare class FormulaLatexRanges {
|
|
|
780
785
|
withContentChange(change: ContentChange, activeRanges: Set<string>): FormulaLatexRanges;
|
|
781
786
|
}
|
|
782
787
|
|
|
783
|
-
export declare const Formulize: {
|
|
784
|
-
create: typeof create;
|
|
785
|
-
};
|
|
786
|
-
|
|
787
|
-
/**
|
|
788
|
-
* User-facing configuration type.
|
|
789
|
-
*/
|
|
790
|
-
export declare type FormulizeConfig = IEnvironment;
|
|
791
|
-
|
|
792
|
-
declare interface FormulizeContextValue {
|
|
793
|
-
instance: FormulizeInstance | null;
|
|
794
|
-
config: FormulizeConfig | null;
|
|
795
|
-
isLoading: boolean;
|
|
796
|
-
error: string | null;
|
|
797
|
-
computationStore: ComputationStore | null;
|
|
798
|
-
/** Reinitialize steps by re-running the semantics function */
|
|
799
|
-
reinitialize: () => void;
|
|
800
|
-
}
|
|
801
|
-
|
|
802
|
-
/**
|
|
803
|
-
* Interface for the object returned by Formulize.create()
|
|
804
|
-
*/
|
|
805
|
-
export declare interface FormulizeInstance {
|
|
806
|
-
environment: IEnvironment;
|
|
807
|
-
computationStore: ComputationStore;
|
|
808
|
-
getVariable: (name: string) => IVariable;
|
|
809
|
-
setVariable: (name: string, value: number) => boolean;
|
|
810
|
-
update: (config: FormulizeConfig) => Promise<FormulizeInstance>;
|
|
811
|
-
destroy: () => void;
|
|
812
|
-
}
|
|
813
|
-
|
|
814
|
-
export declare const FormulizeProvider: default_2.FC<FormulizeProviderProps>;
|
|
815
|
-
|
|
816
|
-
declare interface FormulizeProviderProps {
|
|
817
|
-
config?: FormulizeConfig;
|
|
818
|
-
children: default_2.ReactNode;
|
|
819
|
-
onError?: (error: string | null) => void;
|
|
820
|
-
onReady?: (instance: FormulizeInstance) => void;
|
|
821
|
-
}
|
|
822
|
-
|
|
823
788
|
declare class Fraction extends AugmentedFormulaNodeBase {
|
|
824
789
|
id: string;
|
|
825
790
|
numerator: AugmentedFormulaNode;
|
|
@@ -1144,9 +1109,9 @@ declare type IInput = "drag" | "inline";
|
|
|
1144
1109
|
*
|
|
1145
1110
|
* Usage:
|
|
1146
1111
|
* ```tsx
|
|
1147
|
-
* <
|
|
1112
|
+
* <Provider config={config}>
|
|
1148
1113
|
* <p>The formula <InlineFormula id="kinetic-energy" /> shows energy.</p>
|
|
1149
|
-
* </
|
|
1114
|
+
* </Provider>
|
|
1150
1115
|
* ```
|
|
1151
1116
|
*/
|
|
1152
1117
|
export declare const InlineFormula: default_2.FC<InlineFormulaProps>;
|
|
@@ -1167,9 +1132,9 @@ declare interface InlineFormulaProps {
|
|
|
1167
1132
|
*
|
|
1168
1133
|
* Usage:
|
|
1169
1134
|
* ```tsx
|
|
1170
|
-
* <
|
|
1135
|
+
* <Provider config={config}>
|
|
1171
1136
|
* <p>The mass <InlineVariable id="m" display="withUnits" /> affects energy.</p>
|
|
1172
|
-
* </
|
|
1137
|
+
* </Provider>
|
|
1173
1138
|
* ```
|
|
1174
1139
|
*/
|
|
1175
1140
|
export declare const InlineVariable: default_2.FC<InlineVariableProps>;
|
|
@@ -1187,6 +1152,18 @@ declare interface InlineVariableProps {
|
|
|
1187
1152
|
scale?: number;
|
|
1188
1153
|
}
|
|
1189
1154
|
|
|
1155
|
+
/**
|
|
1156
|
+
* Interface for the object returned by Formulize.create()
|
|
1157
|
+
*/
|
|
1158
|
+
export declare interface Instance {
|
|
1159
|
+
environment: IEnvironment;
|
|
1160
|
+
computationStore: ComputationStore;
|
|
1161
|
+
getVariable: (name: string) => IVariable;
|
|
1162
|
+
setVariable: (name: string, value: number) => boolean;
|
|
1163
|
+
update: (config: Config) => Promise<Instance>;
|
|
1164
|
+
destroy: () => void;
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1190
1167
|
/**
|
|
1191
1168
|
* Plot2D visualization configuration.
|
|
1192
1169
|
* @property type - The type of the plot.
|
|
@@ -1489,6 +1466,15 @@ declare class Op extends AugmentedFormulaNodeBase {
|
|
|
1489
1466
|
toStyledRanges(): FormulaLatexRangeNode[];
|
|
1490
1467
|
}
|
|
1491
1468
|
|
|
1469
|
+
export declare const Provider: default_2.FC<ProviderProps>;
|
|
1470
|
+
|
|
1471
|
+
declare interface ProviderProps {
|
|
1472
|
+
config?: Config;
|
|
1473
|
+
children: default_2.ReactNode;
|
|
1474
|
+
onError?: (error: string | null) => void;
|
|
1475
|
+
onReady?: (instance: Instance) => void;
|
|
1476
|
+
}
|
|
1477
|
+
|
|
1492
1478
|
declare type RangeElement = string | LatexRange;
|
|
1493
1479
|
|
|
1494
1480
|
export declare const register: (name: string, component: React.ComponentType<{
|
|
@@ -1565,7 +1551,7 @@ declare class Space extends AugmentedFormulaNodeBase {
|
|
|
1565
1551
|
|
|
1566
1552
|
/**
|
|
1567
1553
|
* A step control component for navigating through collected steps.
|
|
1568
|
-
* Uses the new reactive step system. Must be used inside a
|
|
1554
|
+
* Uses the new reactive step system. Must be used inside a Provider.
|
|
1569
1555
|
*/
|
|
1570
1556
|
export declare const StepControl: default_2.FC<StepControlProps>;
|
|
1571
1557
|
|
|
@@ -1574,6 +1560,20 @@ export declare interface StepControlProps {
|
|
|
1574
1560
|
className?: string;
|
|
1575
1561
|
}
|
|
1576
1562
|
|
|
1563
|
+
export declare const Store: {
|
|
1564
|
+
create: typeof create;
|
|
1565
|
+
};
|
|
1566
|
+
|
|
1567
|
+
declare interface StoreContextValue {
|
|
1568
|
+
instance: Instance | null;
|
|
1569
|
+
config: Config | null;
|
|
1570
|
+
isLoading: boolean;
|
|
1571
|
+
error: string | null;
|
|
1572
|
+
computationStore: ComputationStore | null;
|
|
1573
|
+
/** Reinitialize steps by re-running the semantics function */
|
|
1574
|
+
reinitialize: () => void;
|
|
1575
|
+
}
|
|
1576
|
+
|
|
1577
1577
|
declare class Strikethrough extends AugmentedFormulaNodeBase {
|
|
1578
1578
|
id: string;
|
|
1579
1579
|
body: AugmentedFormulaNode;
|
|
@@ -1658,11 +1658,11 @@ declare class UnstyledRange {
|
|
|
1658
1658
|
}
|
|
1659
1659
|
|
|
1660
1660
|
/**
|
|
1661
|
-
* Hook to access the
|
|
1662
|
-
* Returns null if not within
|
|
1661
|
+
* Hook to access the Core context.
|
|
1662
|
+
* Returns null if not within Provider, allowing components
|
|
1663
1663
|
* to work both with context and with explicit props.
|
|
1664
1664
|
*/
|
|
1665
|
-
export declare const
|
|
1665
|
+
export declare const useStore: () => StoreContextValue | null;
|
|
1666
1666
|
|
|
1667
1667
|
export declare const Variable: {
|
|
1668
1668
|
/**
|