@drghaliasri/butex 7.1.4 → 7.2.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/document.d.mts +1 -2
- package/dist/document.d.ts +1 -2
- package/dist/document.js +56 -0
- package/dist/document.js.map +1 -1
- package/dist/document.mjs +56 -0
- package/dist/document.mjs.map +1 -1
- package/dist/document2-cli.js +298 -4
- package/dist/document2-cli.js.map +1 -1
- package/dist/document2.d.mts +1 -1
- package/dist/document2.d.ts +1 -1
- package/dist/document2.js +67 -0
- package/dist/document2.js.map +1 -1
- package/dist/document2.mjs +67 -0
- package/dist/document2.mjs.map +1 -1
- package/dist/index.d.mts +129 -2
- package/dist/index.d.ts +129 -2
- package/dist/index.global.js +99 -0
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +99 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +99 -0
- package/dist/index.mjs.map +1 -1
- package/dist/react-document.js +78 -0
- package/dist/react-document.js.map +1 -1
- package/dist/react-document.mjs +78 -0
- package/dist/react-document.mjs.map +1 -1
- package/dist/react-document2-preview.js +62 -0
- package/dist/react-document2-preview.js.map +1 -1
- package/dist/react-document2-preview.mjs +62 -0
- package/dist/react-document2-preview.mjs.map +1 -1
- package/dist/react-document2.d.mts +1 -1
- package/dist/react-document2.d.ts +1 -1
- package/dist/react-document2.js +119 -0
- package/dist/react-document2.js.map +1 -1
- package/dist/react-document2.mjs +119 -0
- package/dist/react-document2.mjs.map +1 -1
- package/dist/react.d.mts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +78 -0
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +78 -0
- package/dist/react.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -778,6 +778,7 @@ var CHARACTER_FONT_SPECS = [
|
|
|
778
778
|
latexFontCommand: "\\maghribi",
|
|
779
779
|
latexFontFamily: "Almaghribi Warsh Quran",
|
|
780
780
|
browserFontStack: '"Almaghribi Warsh Quran", Amiri, "Segoe UI", Tahoma, sans-serif',
|
|
781
|
+
importAliases: ["\\maghribi"],
|
|
781
782
|
svgLayoutKey: "maghribi"
|
|
782
783
|
}
|
|
783
784
|
];
|
|
@@ -2775,6 +2776,88 @@ function buildAtomicOperatorCommandNodeBody(node, side, uiLocale = "ar") {
|
|
|
2775
2776
|
return value;
|
|
2776
2777
|
}
|
|
2777
2778
|
|
|
2779
|
+
// src/editor/standardCommands.ts
|
|
2780
|
+
var STANDARD_COMMANDS = {
|
|
2781
|
+
"\\alpha": { tex: "\\alpha", label: "\u03B1", title: "alpha" },
|
|
2782
|
+
"\\beta": { tex: "\\beta", label: "\u03B2", title: "beta" },
|
|
2783
|
+
"\\gamma": { tex: "\\gamma", label: "\u03B3", title: "gamma" },
|
|
2784
|
+
"\\delta": { tex: "\\delta", label: "\u03B4", title: "delta" },
|
|
2785
|
+
"\\epsilon": { tex: "\\epsilon", label: "\u03B5", title: "epsilon" },
|
|
2786
|
+
"\\eta": { tex: "\\eta", label: "\u03B7", title: "eta" },
|
|
2787
|
+
"\\theta": { tex: "\\theta", label: "\u03B8", title: "theta" },
|
|
2788
|
+
"\\lambda": { tex: "\\lambda", label: "\u03BB", title: "lambda" },
|
|
2789
|
+
"\\mu": { tex: "\\mu", label: "\u03BC", title: "mu" },
|
|
2790
|
+
"\\rho": { tex: "\\rho", label: "\u03C1", title: "rho" },
|
|
2791
|
+
"\\sigma": { tex: "\\sigma", label: "\u03C3", title: "sigma" },
|
|
2792
|
+
"\\tau": { tex: "\\tau", label: "\u03C4", title: "tau" },
|
|
2793
|
+
"\\phi": { tex: "\\phi", label: "\u03C6", title: "phi" },
|
|
2794
|
+
"\\chi": { tex: "\\chi", label: "\u03C7", title: "chi" },
|
|
2795
|
+
"\\psi": { tex: "\\psi", label: "\u03C8", title: "psi" },
|
|
2796
|
+
"\\omega": { tex: "\\omega", label: "\u03C9", title: "omega" },
|
|
2797
|
+
"\\zeta": { tex: "\\zeta", label: "\u03B6", title: "zeta" },
|
|
2798
|
+
"\\nabla": { tex: "\\nabla", label: "\u2207", title: "nabla" },
|
|
2799
|
+
"\\Delta": { tex: "\\Delta", label: "\u0394", title: "Delta" },
|
|
2800
|
+
"\\partial": { tex: "\\partial", label: "\u2202", title: "partial derivative" },
|
|
2801
|
+
"\\Longleftrightarrow": { tex: "\\Longleftrightarrow", label: "\u27FA", title: "long equivalence arrow" },
|
|
2802
|
+
"\\backslash": { tex: "\\backslash", label: "\u2216", title: "reverse solidus" }
|
|
2803
|
+
};
|
|
2804
|
+
function standardCommandSpec(tex) {
|
|
2805
|
+
return Object.prototype.hasOwnProperty.call(STANDARD_COMMANDS, tex) ? STANDARD_COMMANDS[tex] : null;
|
|
2806
|
+
}
|
|
2807
|
+
function isStandardCommandTex(tex) {
|
|
2808
|
+
return standardCommandSpec(tex) !== null;
|
|
2809
|
+
}
|
|
2810
|
+
function chainHasStandardCommands(chain) {
|
|
2811
|
+
for (const node of chain.nodes) {
|
|
2812
|
+
if (node.kind === "standardCommand") {
|
|
2813
|
+
return true;
|
|
2814
|
+
}
|
|
2815
|
+
const childChains = [
|
|
2816
|
+
node.superscript,
|
|
2817
|
+
node.subscript,
|
|
2818
|
+
node.innerExpr,
|
|
2819
|
+
node.numerator,
|
|
2820
|
+
node.denominator,
|
|
2821
|
+
node.radicand,
|
|
2822
|
+
node.rootIndex,
|
|
2823
|
+
node.overExpr,
|
|
2824
|
+
node.underExpr,
|
|
2825
|
+
node.baseExpr
|
|
2826
|
+
];
|
|
2827
|
+
if (childChains.some((child) => child && chainHasStandardCommands(child))) {
|
|
2828
|
+
return true;
|
|
2829
|
+
}
|
|
2830
|
+
if (node.matrixRows?.some((row) => row.some(chainHasStandardCommands))) {
|
|
2831
|
+
return true;
|
|
2832
|
+
}
|
|
2833
|
+
}
|
|
2834
|
+
return false;
|
|
2835
|
+
}
|
|
2836
|
+
function sessionHasStandardCommands(session) {
|
|
2837
|
+
return chainHasStandardCommands(session.englishTree) || chainHasStandardCommands(session.arabicTree);
|
|
2838
|
+
}
|
|
2839
|
+
|
|
2840
|
+
// src/editor/display/standardCommand.ts
|
|
2841
|
+
var STANDARD_COMMAND_CSS = `
|
|
2842
|
+
.standard-command {
|
|
2843
|
+
display: inline-flex;
|
|
2844
|
+
align-items: center;
|
|
2845
|
+
justify-content: center;
|
|
2846
|
+
min-width: 0.9em;
|
|
2847
|
+
font-family: "Cambria Math", "Times New Roman", serif;
|
|
2848
|
+
font-size: 1.05em;
|
|
2849
|
+
line-height: 1;
|
|
2850
|
+
}
|
|
2851
|
+
`.trim();
|
|
2852
|
+
function buildStandardCommandNodeBody(node) {
|
|
2853
|
+
const spec = standardCommandSpec(node.expr);
|
|
2854
|
+
const value = document.createElement("span");
|
|
2855
|
+
value.className = "standard-command";
|
|
2856
|
+
value.title = spec?.title ?? node.expr;
|
|
2857
|
+
value.textContent = spec?.label ?? node.expr;
|
|
2858
|
+
return value;
|
|
2859
|
+
}
|
|
2860
|
+
|
|
2778
2861
|
// src/editor/styles.ts
|
|
2779
2862
|
var CHARACTER_FONT_CSS = NON_DEFAULT_CHARACTER_FONT_SPECS.filter((font) => font.cssClass && font.browserFontStack).map((font) => `.${font.cssClass} {
|
|
2780
2863
|
font-family: ${font.browserFontStack};
|
|
@@ -2984,6 +3067,8 @@ ${MATRIX_ENV_CSS}
|
|
|
2984
3067
|
${ATOMIC_COMMAND_CSS}
|
|
2985
3068
|
|
|
2986
3069
|
${ATOMIC_OPERATOR_COMMAND_CSS}
|
|
3070
|
+
|
|
3071
|
+
${STANDARD_COMMAND_CSS}
|
|
2987
3072
|
`.trim();
|
|
2988
3073
|
function injectBuTeXEditorStyles(doc) {
|
|
2989
3074
|
const d = doc ?? (typeof document !== "undefined" ? document : void 0);
|
|
@@ -3022,6 +3107,8 @@ __export(editor_exports, {
|
|
|
3022
3107
|
NON_DEFAULT_CHARACTER_FONT_SPECS: () => NON_DEFAULT_CHARACTER_FONT_SPECS,
|
|
3023
3108
|
OVERSET_CSS: () => OVERSET_CSS,
|
|
3024
3109
|
SQRT_CSS: () => SQRT_CSS,
|
|
3110
|
+
STANDARD_COMMANDS: () => STANDARD_COMMANDS,
|
|
3111
|
+
STANDARD_COMMAND_CSS: () => STANDARD_COMMAND_CSS,
|
|
3025
3112
|
UNDERSET_CSS: () => UNDERSET_CSS,
|
|
3026
3113
|
accentCommandIdFromTex: () => accentCommandIdFromTex,
|
|
3027
3114
|
accentCommandSpec: () => accentCommandSpec,
|
|
@@ -3097,6 +3184,7 @@ __export(editor_exports, {
|
|
|
3097
3184
|
insertUnderset: () => insertUnderset,
|
|
3098
3185
|
isSelectionActive: () => isSelectionActive,
|
|
3099
3186
|
isSpacingCommandSpec: () => isSpacingCommandSpec,
|
|
3187
|
+
isStandardCommandTex: () => isStandardCommandTex,
|
|
3100
3188
|
mirrorBuTeXOperatorsInTex: () => mirrorBuTeXOperatorsInTex,
|
|
3101
3189
|
moveCaret: () => moveCaret,
|
|
3102
3190
|
moveCaretHorizontal: () => moveCaretHorizontal,
|
|
@@ -3121,6 +3209,7 @@ __export(editor_exports, {
|
|
|
3121
3209
|
runtimeStatusText: () => runtimeStatusText,
|
|
3122
3210
|
selectNode: () => selectNode,
|
|
3123
3211
|
serializeSelection: () => serializeSelection,
|
|
3212
|
+
sessionHasStandardCommands: () => sessionHasStandardCommands,
|
|
3124
3213
|
setArabicReverseNumberTyping: () => setArabicReverseNumberTyping,
|
|
3125
3214
|
setArrayColumnAlignment: () => setArrayColumnAlignment,
|
|
3126
3215
|
setCaret: () => setCaret,
|
|
@@ -3132,6 +3221,7 @@ __export(editor_exports, {
|
|
|
3132
3221
|
setSelectionFromMouse: () => setSelectionFromMouse,
|
|
3133
3222
|
setSplitLeafTyping: () => setSplitLeafTyping,
|
|
3134
3223
|
shouldMirrorOperatorDisplay: () => shouldMirrorOperatorDisplay,
|
|
3224
|
+
standardCommandSpec: () => standardCommandSpec,
|
|
3135
3225
|
switchSide: () => switchSide,
|
|
3136
3226
|
syncSelectionToCaret: () => syncSelectionToCaret,
|
|
3137
3227
|
syncStateSummary: () => syncStateSummary,
|
|
@@ -3523,6 +3613,9 @@ function renderNodeEnglish(node, options) {
|
|
|
3523
3613
|
const body = atomicOperatorCommandSpec(node.expr)?.Tex ?? node.expr;
|
|
3524
3614
|
return `${body}${latinScripts(node, options)}`;
|
|
3525
3615
|
}
|
|
3616
|
+
if (node.kind === "standardCommand") {
|
|
3617
|
+
return `${node.expr}${latinScripts(node, options)}`;
|
|
3618
|
+
}
|
|
3526
3619
|
if (node.kind === "char") {
|
|
3527
3620
|
return `${renderCharContent(node, options)}${latinScripts(node, options)}`;
|
|
3528
3621
|
}
|
|
@@ -3571,6 +3664,9 @@ function renderNodeArabic(node, options) {
|
|
|
3571
3664
|
const content = spec?.mirror ? `\\butexmirror{${tex}}` : tex;
|
|
3572
3665
|
return arabicScripts(node, content, options);
|
|
3573
3666
|
}
|
|
3667
|
+
if (node.kind === "standardCommand") {
|
|
3668
|
+
return arabicScripts(node, node.expr, options);
|
|
3669
|
+
}
|
|
3574
3670
|
if (node.kind === "char") {
|
|
3575
3671
|
const expr = formatDigits(node.expr, selectedDigitForm(options));
|
|
3576
3672
|
const content = renderCharContent(node, options);
|
|
@@ -5943,6 +6039,9 @@ function buildNodeBody(node, buildChain, side, digitForm = "western", uiLocale =
|
|
|
5943
6039
|
if (node.kind === "atomicOperatorCommand") {
|
|
5944
6040
|
return buildAtomicOperatorCommandNodeBody(node, side, uiLocale);
|
|
5945
6041
|
}
|
|
6042
|
+
if (node.kind === "standardCommand") {
|
|
6043
|
+
return buildStandardCommandNodeBody(node);
|
|
6044
|
+
}
|
|
5946
6045
|
return buildBaseNodeBody(node, digitForm, side);
|
|
5947
6046
|
}
|
|
5948
6047
|
|