@drghaliasri/butex 6.1.5 → 7.0.2
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/README.md +43 -12
- package/dist/document.js +21 -4
- package/dist/document.js.map +1 -1
- package/dist/document.mjs +21 -4
- package/dist/document.mjs.map +1 -1
- package/dist/document2-cli.js +551 -5
- package/dist/document2-cli.js.map +1 -1
- package/dist/document2.d.mts +62 -2
- package/dist/document2.d.ts +62 -2
- package/dist/document2.js +476 -51
- package/dist/document2.js.map +1 -1
- package/dist/document2.mjs +476 -51
- package/dist/document2.mjs.map +1 -1
- package/dist/index.global.js +104 -6
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +104 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +104 -6
- package/dist/index.mjs.map +1 -1
- package/dist/react-document.js +2066 -599
- package/dist/react-document.js.map +1 -1
- package/dist/react-document.mjs +2064 -596
- package/dist/react-document.mjs.map +1 -1
- package/dist/react-document2.d.mts +12 -5
- package/dist/react-document2.d.ts +12 -5
- package/dist/react-document2.js +3704 -1172
- package/dist/react-document2.js.map +1 -1
- package/dist/react-document2.mjs +3692 -1159
- package/dist/react-document2.mjs.map +1 -1
- package/dist/react.d.mts +9 -2
- package/dist/react.d.ts +9 -2
- package/dist/react.js +1954 -507
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +1955 -507
- package/dist/react.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.global.js
CHANGED
|
@@ -1847,7 +1847,22 @@ mjx-container[jax="CHTML"] .butex-preview-mirror {
|
|
|
1847
1847
|
matrixBrackets: "\u0645\u0635\u0641\u0648\u0641\u0629 \u0628\u064A\u0646 \u0645\u0639\u0642\u0648\u0641\u064A\u0646",
|
|
1848
1848
|
matrixBraces: "\u0645\u0635\u0641\u0648\u0641\u0629 \u0628\u064A\u0646 \u062D\u0627\u0635\u0631\u062A\u064A\u0646",
|
|
1849
1849
|
matrixBars: "\u0645\u0635\u0641\u0648\u0641\u0629 \u0628\u064A\u0646 \u062E\u0637\u064A\u0646",
|
|
1850
|
-
matrixDoubleBars: "\u0645\u0635\u0641\u0648\u0641\u0629 \u0628\u064A\u0646 \u062E\u0637\u064A\u0646 \u0645\u0632\u062F\u0648\u062C\u064A\u0646"
|
|
1850
|
+
matrixDoubleBars: "\u0645\u0635\u0641\u0648\u0641\u0629 \u0628\u064A\u0646 \u062E\u0637\u064A\u0646 \u0645\u0632\u062F\u0648\u062C\u064A\u0646",
|
|
1851
|
+
compactToolbar: "\u0634\u0631\u064A\u0637 \u0623\u0648\u0627\u0645\u0631 \u0627\u0644\u0645\u0639\u0627\u062F\u0644\u0629",
|
|
1852
|
+
moreActions: "\u0627\u0644\u0645\u0632\u064A\u062F",
|
|
1853
|
+
commandCategories: "\u0641\u0626\u0627\u062A \u0627\u0644\u0623\u0648\u0627\u0645\u0631",
|
|
1854
|
+
back: "\u0631\u062C\u0648\u0639",
|
|
1855
|
+
closeActions: "\u0625\u063A\u0644\u0627\u0642 \u0627\u0644\u0623\u0648\u0627\u0645\u0631",
|
|
1856
|
+
matrices: "\u0627\u0644\u0645\u0635\u0641\u0648\u0641\u0627\u062A",
|
|
1857
|
+
typography: "\u0627\u0644\u062E\u0637 \u0648\u0627\u0644\u0625\u062F\u062E\u0627\u0644",
|
|
1858
|
+
digitForms: "\u0623\u0634\u0643\u0627\u0644 \u0627\u0644\u0623\u0631\u0642\u0627\u0645",
|
|
1859
|
+
commonMatrixSizes: "\u0623\u062D\u062C\u0627\u0645 \u0634\u0627\u0626\u0639\u0629",
|
|
1860
|
+
decreaseRows: "\u062A\u0642\u0644\u064A\u0644 \u0627\u0644\u0635\u0641\u0648\u0641",
|
|
1861
|
+
increaseRows: "\u0632\u064A\u0627\u062F\u0629 \u0627\u0644\u0635\u0641\u0648\u0641",
|
|
1862
|
+
decreaseColumns: "\u062A\u0642\u0644\u064A\u0644 \u0627\u0644\u0623\u0639\u0645\u062F\u0629",
|
|
1863
|
+
increaseColumns: "\u0632\u064A\u0627\u062F\u0629 \u0627\u0644\u0623\u0639\u0645\u062F\u0629",
|
|
1864
|
+
showPreview: "\u0625\u0638\u0647\u0627\u0631 \u0627\u0644\u0645\u0639\u0627\u064A\u0646\u0629",
|
|
1865
|
+
hidePreview: "\u0625\u062E\u0641\u0627\u0621 \u0627\u0644\u0645\u0639\u0627\u064A\u0646\u0629"
|
|
1851
1866
|
},
|
|
1852
1867
|
en: {
|
|
1853
1868
|
undoRedo: "Undo and redo",
|
|
@@ -1959,7 +1974,22 @@ mjx-container[jax="CHTML"] .butex-preview-mirror {
|
|
|
1959
1974
|
matrixBrackets: "Matrix in brackets",
|
|
1960
1975
|
matrixBraces: "Matrix in braces",
|
|
1961
1976
|
matrixBars: "Matrix between bars",
|
|
1962
|
-
matrixDoubleBars: "Matrix between double bars"
|
|
1977
|
+
matrixDoubleBars: "Matrix between double bars",
|
|
1978
|
+
compactToolbar: "Equation command toolbar",
|
|
1979
|
+
moreActions: "More",
|
|
1980
|
+
commandCategories: "Command categories",
|
|
1981
|
+
back: "Back",
|
|
1982
|
+
closeActions: "Close actions",
|
|
1983
|
+
matrices: "Matrices",
|
|
1984
|
+
typography: "Typography and input",
|
|
1985
|
+
digitForms: "Digit forms",
|
|
1986
|
+
commonMatrixSizes: "Common sizes",
|
|
1987
|
+
decreaseRows: "Decrease rows",
|
|
1988
|
+
increaseRows: "Increase rows",
|
|
1989
|
+
decreaseColumns: "Decrease columns",
|
|
1990
|
+
increaseColumns: "Increase columns",
|
|
1991
|
+
showPreview: "Show preview",
|
|
1992
|
+
hidePreview: "Hide preview"
|
|
1963
1993
|
}
|
|
1964
1994
|
};
|
|
1965
1995
|
function equationEditorMessages(locale) {
|
|
@@ -2771,14 +2801,20 @@ mjx-container[jax="CHTML"] .butex-preview-mirror {
|
|
|
2771
2801
|
${BUTEX_FONT_FACE_CSS}
|
|
2772
2802
|
|
|
2773
2803
|
.surface {
|
|
2804
|
+
background: var(--butex-surface-bg, linear-gradient(180deg, #ffffff 0%, #fafbfc 100%));
|
|
2774
2805
|
border: 1px solid var(--butex-border, #e2e8f0);
|
|
2775
2806
|
border-radius: 12px;
|
|
2776
|
-
min-height: 100px;
|
|
2777
|
-
padding: 8px 10px;
|
|
2778
|
-
background: var(--butex-surface-bg, linear-gradient(180deg, #ffffff 0%, #fafbfc 100%));
|
|
2779
2807
|
color: var(--butex-surface-fg, #0f172a);
|
|
2780
|
-
outline: none;
|
|
2781
2808
|
cursor: text;
|
|
2809
|
+
max-width: 100%;
|
|
2810
|
+
min-height: 100px;
|
|
2811
|
+
min-width: 0;
|
|
2812
|
+
outline: none;
|
|
2813
|
+
overflow-x: auto;
|
|
2814
|
+
overflow-y: hidden;
|
|
2815
|
+
overscroll-behavior-inline: contain;
|
|
2816
|
+
padding: 8px 10px;
|
|
2817
|
+
touch-action: pan-x pan-y;
|
|
2782
2818
|
transition: box-shadow 0.15s ease, border-color 0.15s ease;
|
|
2783
2819
|
}
|
|
2784
2820
|
|
|
@@ -2843,6 +2879,17 @@ ${CHARACTER_FONT_CSS}
|
|
|
2843
2879
|
50% { opacity: 0; }
|
|
2844
2880
|
}
|
|
2845
2881
|
|
|
2882
|
+
@media (prefers-reduced-motion: reduce) {
|
|
2883
|
+
.surface {
|
|
2884
|
+
scroll-behavior: auto;
|
|
2885
|
+
transition: none;
|
|
2886
|
+
}
|
|
2887
|
+
|
|
2888
|
+
.caret {
|
|
2889
|
+
animation: none;
|
|
2890
|
+
}
|
|
2891
|
+
}
|
|
2892
|
+
|
|
2846
2893
|
.node {
|
|
2847
2894
|
display: inline-flex;
|
|
2848
2895
|
align-items: stretch;
|
|
@@ -5918,6 +5965,42 @@ ${ATOMIC_OPERATOR_COMMAND_CSS}
|
|
|
5918
5965
|
}
|
|
5919
5966
|
|
|
5920
5967
|
// src/editor/runtime.ts
|
|
5968
|
+
var CARET_REVEAL_GUTTER_PX = 8;
|
|
5969
|
+
function revealCaretInSurface(surfaceEl, caretEl) {
|
|
5970
|
+
const activeTarget = caretEl ?? surfaceEl.querySelector(".caret") ?? surfaceEl.querySelector(".node.selected");
|
|
5971
|
+
if (!activeTarget) {
|
|
5972
|
+
return;
|
|
5973
|
+
}
|
|
5974
|
+
const surfaceRect = surfaceEl.getBoundingClientRect();
|
|
5975
|
+
const targetRect = activeTarget.getBoundingClientRect();
|
|
5976
|
+
if (surfaceRect.width <= 0) {
|
|
5977
|
+
return;
|
|
5978
|
+
}
|
|
5979
|
+
const gutter = Math.min(CARET_REVEAL_GUTTER_PX, surfaceRect.width / 4);
|
|
5980
|
+
const visibleLeft = surfaceRect.left + gutter;
|
|
5981
|
+
const visibleRight = surfaceRect.right - gutter;
|
|
5982
|
+
const visibleWidth = visibleRight - visibleLeft;
|
|
5983
|
+
let delta = 0;
|
|
5984
|
+
if (targetRect.width > visibleWidth) {
|
|
5985
|
+
if (targetRect.right < visibleLeft) {
|
|
5986
|
+
delta = targetRect.right - visibleLeft;
|
|
5987
|
+
} else if (targetRect.left > visibleRight) {
|
|
5988
|
+
delta = targetRect.left - visibleRight;
|
|
5989
|
+
}
|
|
5990
|
+
} else if (targetRect.left < visibleLeft) {
|
|
5991
|
+
delta = targetRect.left - visibleLeft;
|
|
5992
|
+
} else if (targetRect.right > visibleRight) {
|
|
5993
|
+
delta = targetRect.right - visibleRight;
|
|
5994
|
+
}
|
|
5995
|
+
if (delta === 0) {
|
|
5996
|
+
return;
|
|
5997
|
+
}
|
|
5998
|
+
if (typeof surfaceEl.scrollBy === "function") {
|
|
5999
|
+
surfaceEl.scrollBy({ left: delta, behavior: "auto" });
|
|
6000
|
+
} else {
|
|
6001
|
+
surfaceEl.scrollLeft += delta;
|
|
6002
|
+
}
|
|
6003
|
+
}
|
|
5921
6004
|
function createEditorRuntime(options) {
|
|
5922
6005
|
const { surfaceEl, inputEl } = options;
|
|
5923
6006
|
const buttonElements = options.buttonElements ?? {};
|
|
@@ -5935,6 +6018,16 @@ ${ATOMIC_OPERATOR_COMMAND_CSS}
|
|
|
5935
6018
|
let dragChanged = false;
|
|
5936
6019
|
let composingInput = false;
|
|
5937
6020
|
let pendingCompositionText = null;
|
|
6021
|
+
let caretRevealFrame = null;
|
|
6022
|
+
function scheduleCaretReveal() {
|
|
6023
|
+
if (caretRevealFrame !== null) {
|
|
6024
|
+
cancelAnimationFrame(caretRevealFrame);
|
|
6025
|
+
}
|
|
6026
|
+
caretRevealFrame = requestAnimationFrame(() => {
|
|
6027
|
+
caretRevealFrame = null;
|
|
6028
|
+
revealCaretInSurface(surfaceEl);
|
|
6029
|
+
});
|
|
6030
|
+
}
|
|
5938
6031
|
function resetInputElement() {
|
|
5939
6032
|
if (!inputEl) {
|
|
5940
6033
|
return;
|
|
@@ -6301,6 +6394,7 @@ ${ATOMIC_OPERATOR_COMMAND_CSS}
|
|
|
6301
6394
|
surfaceEl.innerHTML = "";
|
|
6302
6395
|
const activeTree = session[activeTreeKey(session.activeSide)];
|
|
6303
6396
|
surfaceEl.appendChild(buildChain(activeTree));
|
|
6397
|
+
scheduleCaretReveal();
|
|
6304
6398
|
if (initialKeyboardFocusPending) {
|
|
6305
6399
|
requestAnimationFrame(focusInput);
|
|
6306
6400
|
initialKeyboardFocusPending = false;
|
|
@@ -6616,6 +6710,10 @@ ${ATOMIC_OPERATOR_COMMAND_CSS}
|
|
|
6616
6710
|
const api = {
|
|
6617
6711
|
render,
|
|
6618
6712
|
destroy: () => {
|
|
6713
|
+
if (caretRevealFrame !== null) {
|
|
6714
|
+
cancelAnimationFrame(caretRevealFrame);
|
|
6715
|
+
caretRevealFrame = null;
|
|
6716
|
+
}
|
|
6619
6717
|
surfaceEl.removeEventListener("keydown", onKeyDown);
|
|
6620
6718
|
inputEl?.removeEventListener("keydown", onKeyDown);
|
|
6621
6719
|
inputEl?.removeEventListener("beforeinput", onBeforeInput);
|