@drghaliasri/butex 6.1.5 → 7.0.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/README.md +41 -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 +21 -4
- package/dist/document2-cli.js.map +1 -1
- package/dist/document2.d.mts +1 -0
- package/dist/document2.d.ts +1 -0
- package/dist/document2.js +22 -4
- package/dist/document2.js.map +1 -1
- package/dist/document2.mjs +22 -4
- 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 +3636 -1104
- package/dist/react-document2.js.map +1 -1
- package/dist/react-document2.mjs +3630 -1097
- 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/react.mjs
CHANGED
|
@@ -1,31 +1,12 @@
|
|
|
1
|
-
// src/react/matrixPickerCss.ts
|
|
2
|
-
var MATRIX_PICKER_CSS = `
|
|
3
|
-
.butex-widget .matrix-grid-picker,
|
|
4
|
-
.butex-widget .matrix-grid-cell {
|
|
5
|
-
box-sizing: border-box;
|
|
6
|
-
}
|
|
7
|
-
`.trim();
|
|
8
|
-
var MATRIX_PICKER_STYLE_ID = "butex-matrix-picker-css";
|
|
9
|
-
function injectMatrixPickerCss(doc) {
|
|
10
|
-
const d = doc ?? (typeof document !== "undefined" ? document : void 0);
|
|
11
|
-
if (!d || d.getElementById(MATRIX_PICKER_STYLE_ID)) {
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
const style = d.createElement("style");
|
|
15
|
-
style.id = MATRIX_PICKER_STYLE_ID;
|
|
16
|
-
style.textContent = MATRIX_PICKER_CSS;
|
|
17
|
-
d.head.appendChild(style);
|
|
18
|
-
}
|
|
19
|
-
injectMatrixPickerCss();
|
|
20
|
-
|
|
21
1
|
// src/react/ButexEditor.tsx
|
|
22
2
|
import {
|
|
23
3
|
forwardRef,
|
|
24
4
|
useCallback,
|
|
25
|
-
useEffect,
|
|
5
|
+
useEffect as useEffect4,
|
|
6
|
+
useId as useId2,
|
|
26
7
|
useImperativeHandle,
|
|
27
|
-
useRef,
|
|
28
|
-
useState
|
|
8
|
+
useRef as useRef3,
|
|
9
|
+
useState as useState2
|
|
29
10
|
} from "react";
|
|
30
11
|
|
|
31
12
|
// src/editor/factory.ts
|
|
@@ -2721,7 +2702,22 @@ var EQUATION_EDITOR_MESSAGES = {
|
|
|
2721
2702
|
matrixBrackets: "\u0645\u0635\u0641\u0648\u0641\u0629 \u0628\u064A\u0646 \u0645\u0639\u0642\u0648\u0641\u064A\u0646",
|
|
2722
2703
|
matrixBraces: "\u0645\u0635\u0641\u0648\u0641\u0629 \u0628\u064A\u0646 \u062D\u0627\u0635\u0631\u062A\u064A\u0646",
|
|
2723
2704
|
matrixBars: "\u0645\u0635\u0641\u0648\u0641\u0629 \u0628\u064A\u0646 \u062E\u0637\u064A\u0646",
|
|
2724
|
-
matrixDoubleBars: "\u0645\u0635\u0641\u0648\u0641\u0629 \u0628\u064A\u0646 \u062E\u0637\u064A\u0646 \u0645\u0632\u062F\u0648\u062C\u064A\u0646"
|
|
2705
|
+
matrixDoubleBars: "\u0645\u0635\u0641\u0648\u0641\u0629 \u0628\u064A\u0646 \u062E\u0637\u064A\u0646 \u0645\u0632\u062F\u0648\u062C\u064A\u0646",
|
|
2706
|
+
compactToolbar: "\u0634\u0631\u064A\u0637 \u0623\u0648\u0627\u0645\u0631 \u0627\u0644\u0645\u0639\u0627\u062F\u0644\u0629",
|
|
2707
|
+
moreActions: "\u0627\u0644\u0645\u0632\u064A\u062F",
|
|
2708
|
+
commandCategories: "\u0641\u0626\u0627\u062A \u0627\u0644\u0623\u0648\u0627\u0645\u0631",
|
|
2709
|
+
back: "\u0631\u062C\u0648\u0639",
|
|
2710
|
+
closeActions: "\u0625\u063A\u0644\u0627\u0642 \u0627\u0644\u0623\u0648\u0627\u0645\u0631",
|
|
2711
|
+
matrices: "\u0627\u0644\u0645\u0635\u0641\u0648\u0641\u0627\u062A",
|
|
2712
|
+
typography: "\u0627\u0644\u062E\u0637 \u0648\u0627\u0644\u0625\u062F\u062E\u0627\u0644",
|
|
2713
|
+
digitForms: "\u0623\u0634\u0643\u0627\u0644 \u0627\u0644\u0623\u0631\u0642\u0627\u0645",
|
|
2714
|
+
commonMatrixSizes: "\u0623\u062D\u062C\u0627\u0645 \u0634\u0627\u0626\u0639\u0629",
|
|
2715
|
+
decreaseRows: "\u062A\u0642\u0644\u064A\u0644 \u0627\u0644\u0635\u0641\u0648\u0641",
|
|
2716
|
+
increaseRows: "\u0632\u064A\u0627\u062F\u0629 \u0627\u0644\u0635\u0641\u0648\u0641",
|
|
2717
|
+
decreaseColumns: "\u062A\u0642\u0644\u064A\u0644 \u0627\u0644\u0623\u0639\u0645\u062F\u0629",
|
|
2718
|
+
increaseColumns: "\u0632\u064A\u0627\u062F\u0629 \u0627\u0644\u0623\u0639\u0645\u062F\u0629",
|
|
2719
|
+
showPreview: "\u0625\u0638\u0647\u0627\u0631 \u0627\u0644\u0645\u0639\u0627\u064A\u0646\u0629",
|
|
2720
|
+
hidePreview: "\u0625\u062E\u0641\u0627\u0621 \u0627\u0644\u0645\u0639\u0627\u064A\u0646\u0629"
|
|
2725
2721
|
},
|
|
2726
2722
|
en: {
|
|
2727
2723
|
undoRedo: "Undo and redo",
|
|
@@ -2833,7 +2829,22 @@ var EQUATION_EDITOR_MESSAGES = {
|
|
|
2833
2829
|
matrixBrackets: "Matrix in brackets",
|
|
2834
2830
|
matrixBraces: "Matrix in braces",
|
|
2835
2831
|
matrixBars: "Matrix between bars",
|
|
2836
|
-
matrixDoubleBars: "Matrix between double bars"
|
|
2832
|
+
matrixDoubleBars: "Matrix between double bars",
|
|
2833
|
+
compactToolbar: "Equation command toolbar",
|
|
2834
|
+
moreActions: "More",
|
|
2835
|
+
commandCategories: "Command categories",
|
|
2836
|
+
back: "Back",
|
|
2837
|
+
closeActions: "Close actions",
|
|
2838
|
+
matrices: "Matrices",
|
|
2839
|
+
typography: "Typography and input",
|
|
2840
|
+
digitForms: "Digit forms",
|
|
2841
|
+
commonMatrixSizes: "Common sizes",
|
|
2842
|
+
decreaseRows: "Decrease rows",
|
|
2843
|
+
increaseRows: "Increase rows",
|
|
2844
|
+
decreaseColumns: "Decrease columns",
|
|
2845
|
+
increaseColumns: "Increase columns",
|
|
2846
|
+
showPreview: "Show preview",
|
|
2847
|
+
hidePreview: "Hide preview"
|
|
2837
2848
|
}
|
|
2838
2849
|
};
|
|
2839
2850
|
function equationEditorMessages(locale) {
|
|
@@ -5144,14 +5155,20 @@ var BUTEX_EDITOR_CSS = `
|
|
|
5144
5155
|
${BUTEX_FONT_FACE_CSS}
|
|
5145
5156
|
|
|
5146
5157
|
.surface {
|
|
5158
|
+
background: var(--butex-surface-bg, linear-gradient(180deg, #ffffff 0%, #fafbfc 100%));
|
|
5147
5159
|
border: 1px solid var(--butex-border, #e2e8f0);
|
|
5148
5160
|
border-radius: 12px;
|
|
5149
|
-
min-height: 100px;
|
|
5150
|
-
padding: 8px 10px;
|
|
5151
|
-
background: var(--butex-surface-bg, linear-gradient(180deg, #ffffff 0%, #fafbfc 100%));
|
|
5152
5161
|
color: var(--butex-surface-fg, #0f172a);
|
|
5153
|
-
outline: none;
|
|
5154
5162
|
cursor: text;
|
|
5163
|
+
max-width: 100%;
|
|
5164
|
+
min-height: 100px;
|
|
5165
|
+
min-width: 0;
|
|
5166
|
+
outline: none;
|
|
5167
|
+
overflow-x: auto;
|
|
5168
|
+
overflow-y: hidden;
|
|
5169
|
+
overscroll-behavior-inline: contain;
|
|
5170
|
+
padding: 8px 10px;
|
|
5171
|
+
touch-action: pan-x pan-y;
|
|
5155
5172
|
transition: box-shadow 0.15s ease, border-color 0.15s ease;
|
|
5156
5173
|
}
|
|
5157
5174
|
|
|
@@ -5216,6 +5233,17 @@ ${CHARACTER_FONT_CSS}
|
|
|
5216
5233
|
50% { opacity: 0; }
|
|
5217
5234
|
}
|
|
5218
5235
|
|
|
5236
|
+
@media (prefers-reduced-motion: reduce) {
|
|
5237
|
+
.surface {
|
|
5238
|
+
scroll-behavior: auto;
|
|
5239
|
+
transition: none;
|
|
5240
|
+
}
|
|
5241
|
+
|
|
5242
|
+
.caret {
|
|
5243
|
+
animation: none;
|
|
5244
|
+
}
|
|
5245
|
+
}
|
|
5246
|
+
|
|
5219
5247
|
.node {
|
|
5220
5248
|
display: inline-flex;
|
|
5221
5249
|
align-items: stretch;
|
|
@@ -5347,6 +5375,42 @@ function injectBuTeXEditorStyles(doc) {
|
|
|
5347
5375
|
}
|
|
5348
5376
|
|
|
5349
5377
|
// src/editor/runtime.ts
|
|
5378
|
+
var CARET_REVEAL_GUTTER_PX = 8;
|
|
5379
|
+
function revealCaretInSurface(surfaceEl, caretEl) {
|
|
5380
|
+
const activeTarget = caretEl ?? surfaceEl.querySelector(".caret") ?? surfaceEl.querySelector(".node.selected");
|
|
5381
|
+
if (!activeTarget) {
|
|
5382
|
+
return;
|
|
5383
|
+
}
|
|
5384
|
+
const surfaceRect = surfaceEl.getBoundingClientRect();
|
|
5385
|
+
const targetRect = activeTarget.getBoundingClientRect();
|
|
5386
|
+
if (surfaceRect.width <= 0) {
|
|
5387
|
+
return;
|
|
5388
|
+
}
|
|
5389
|
+
const gutter = Math.min(CARET_REVEAL_GUTTER_PX, surfaceRect.width / 4);
|
|
5390
|
+
const visibleLeft = surfaceRect.left + gutter;
|
|
5391
|
+
const visibleRight = surfaceRect.right - gutter;
|
|
5392
|
+
const visibleWidth = visibleRight - visibleLeft;
|
|
5393
|
+
let delta = 0;
|
|
5394
|
+
if (targetRect.width > visibleWidth) {
|
|
5395
|
+
if (targetRect.right < visibleLeft) {
|
|
5396
|
+
delta = targetRect.right - visibleLeft;
|
|
5397
|
+
} else if (targetRect.left > visibleRight) {
|
|
5398
|
+
delta = targetRect.left - visibleRight;
|
|
5399
|
+
}
|
|
5400
|
+
} else if (targetRect.left < visibleLeft) {
|
|
5401
|
+
delta = targetRect.left - visibleLeft;
|
|
5402
|
+
} else if (targetRect.right > visibleRight) {
|
|
5403
|
+
delta = targetRect.right - visibleRight;
|
|
5404
|
+
}
|
|
5405
|
+
if (delta === 0) {
|
|
5406
|
+
return;
|
|
5407
|
+
}
|
|
5408
|
+
if (typeof surfaceEl.scrollBy === "function") {
|
|
5409
|
+
surfaceEl.scrollBy({ left: delta, behavior: "auto" });
|
|
5410
|
+
} else {
|
|
5411
|
+
surfaceEl.scrollLeft += delta;
|
|
5412
|
+
}
|
|
5413
|
+
}
|
|
5350
5414
|
function createEditorRuntime(options) {
|
|
5351
5415
|
const { surfaceEl, inputEl } = options;
|
|
5352
5416
|
const buttonElements = options.buttonElements ?? {};
|
|
@@ -5364,6 +5428,16 @@ function createEditorRuntime(options) {
|
|
|
5364
5428
|
let dragChanged = false;
|
|
5365
5429
|
let composingInput = false;
|
|
5366
5430
|
let pendingCompositionText = null;
|
|
5431
|
+
let caretRevealFrame = null;
|
|
5432
|
+
function scheduleCaretReveal() {
|
|
5433
|
+
if (caretRevealFrame !== null) {
|
|
5434
|
+
cancelAnimationFrame(caretRevealFrame);
|
|
5435
|
+
}
|
|
5436
|
+
caretRevealFrame = requestAnimationFrame(() => {
|
|
5437
|
+
caretRevealFrame = null;
|
|
5438
|
+
revealCaretInSurface(surfaceEl);
|
|
5439
|
+
});
|
|
5440
|
+
}
|
|
5367
5441
|
function resetInputElement() {
|
|
5368
5442
|
if (!inputEl) {
|
|
5369
5443
|
return;
|
|
@@ -5730,6 +5804,7 @@ function createEditorRuntime(options) {
|
|
|
5730
5804
|
surfaceEl.innerHTML = "";
|
|
5731
5805
|
const activeTree = session[activeTreeKey(session.activeSide)];
|
|
5732
5806
|
surfaceEl.appendChild(buildChain(activeTree));
|
|
5807
|
+
scheduleCaretReveal();
|
|
5733
5808
|
if (initialKeyboardFocusPending) {
|
|
5734
5809
|
requestAnimationFrame(focusInput);
|
|
5735
5810
|
initialKeyboardFocusPending = false;
|
|
@@ -6045,6 +6120,10 @@ function createEditorRuntime(options) {
|
|
|
6045
6120
|
const api = {
|
|
6046
6121
|
render,
|
|
6047
6122
|
destroy: () => {
|
|
6123
|
+
if (caretRevealFrame !== null) {
|
|
6124
|
+
cancelAnimationFrame(caretRevealFrame);
|
|
6125
|
+
caretRevealFrame = null;
|
|
6126
|
+
}
|
|
6048
6127
|
surfaceEl.removeEventListener("keydown", onKeyDown);
|
|
6049
6128
|
inputEl?.removeEventListener("keydown", onKeyDown);
|
|
6050
6129
|
inputEl?.removeEventListener("beforeinput", onBeforeInput);
|
|
@@ -6600,6 +6679,210 @@ async function renderBuTeXMathIsland(tex, options = {}) {
|
|
|
6600
6679
|
return node;
|
|
6601
6680
|
}
|
|
6602
6681
|
|
|
6682
|
+
// src/react/matrixPickerCss.ts
|
|
6683
|
+
var MATRIX_PICKER_CSS = `
|
|
6684
|
+
.butex-widget .matrix-grid-picker,
|
|
6685
|
+
.butex-widget .matrix-grid-cell {
|
|
6686
|
+
box-sizing: border-box;
|
|
6687
|
+
}
|
|
6688
|
+
|
|
6689
|
+
.butex-widget .matrix-command-menu {
|
|
6690
|
+
position: relative;
|
|
6691
|
+
display: inline-flex;
|
|
6692
|
+
}
|
|
6693
|
+
|
|
6694
|
+
.butex-widget .matrix-command-btn::after {
|
|
6695
|
+
content: "";
|
|
6696
|
+
width: 0;
|
|
6697
|
+
height: 0;
|
|
6698
|
+
margin-inline-start: 3px;
|
|
6699
|
+
border-inline: 3px solid transparent;
|
|
6700
|
+
border-block-start: 4px solid currentColor;
|
|
6701
|
+
opacity: 0.72;
|
|
6702
|
+
}
|
|
6703
|
+
|
|
6704
|
+
.butex-widget .toolbar-matrix-icon {
|
|
6705
|
+
width: 14px;
|
|
6706
|
+
height: 14px;
|
|
6707
|
+
display: grid;
|
|
6708
|
+
grid-template-columns: repeat(2, 1fr);
|
|
6709
|
+
gap: 2px;
|
|
6710
|
+
}
|
|
6711
|
+
|
|
6712
|
+
.butex-widget .toolbar-matrix-icon span {
|
|
6713
|
+
border: 1px solid currentColor;
|
|
6714
|
+
border-radius: 2px;
|
|
6715
|
+
}
|
|
6716
|
+
|
|
6717
|
+
.butex-widget .matrix-command-popover {
|
|
6718
|
+
position: absolute;
|
|
6719
|
+
z-index: var(--butex-z-popover);
|
|
6720
|
+
top: calc(100% + 5px);
|
|
6721
|
+
right: 0;
|
|
6722
|
+
width: 252px;
|
|
6723
|
+
padding: 8px;
|
|
6724
|
+
border: 1px solid var(--butex-border);
|
|
6725
|
+
border-radius: 9px;
|
|
6726
|
+
background: var(--butex-panel);
|
|
6727
|
+
color: var(--butex-fg);
|
|
6728
|
+
box-shadow: var(--butex-shadow-md);
|
|
6729
|
+
}
|
|
6730
|
+
|
|
6731
|
+
.butex-widget .matrix-command-popover[hidden] {
|
|
6732
|
+
display: none;
|
|
6733
|
+
}
|
|
6734
|
+
|
|
6735
|
+
.butex-widget .matrix-style-options,
|
|
6736
|
+
.butex-widget .matrix-edit-actions,
|
|
6737
|
+
.butex-widget .matrix-custom-size {
|
|
6738
|
+
display: flex;
|
|
6739
|
+
gap: 5px;
|
|
6740
|
+
align-items: center;
|
|
6741
|
+
flex-wrap: wrap;
|
|
6742
|
+
}
|
|
6743
|
+
|
|
6744
|
+
.butex-widget .toolbar .matrix-style-option,
|
|
6745
|
+
.butex-widget .toolbar .matrix-edit-actions button,
|
|
6746
|
+
.butex-widget .toolbar .matrix-insert-custom {
|
|
6747
|
+
height: 26px;
|
|
6748
|
+
min-width: 30px;
|
|
6749
|
+
padding: 0 6px;
|
|
6750
|
+
border-radius: 7px;
|
|
6751
|
+
}
|
|
6752
|
+
|
|
6753
|
+
.butex-widget .toolbar .matrix-style-option[aria-selected="true"] {
|
|
6754
|
+
border-color: var(--butex-toolbar-hover-border);
|
|
6755
|
+
background: var(--butex-toolbar-hover-bg);
|
|
6756
|
+
}
|
|
6757
|
+
|
|
6758
|
+
.butex-widget .matrix-size-readout {
|
|
6759
|
+
margin: 7px 0 5px;
|
|
6760
|
+
font-size: 12px;
|
|
6761
|
+
color: var(--butex-muted);
|
|
6762
|
+
text-align: center;
|
|
6763
|
+
direction: ltr;
|
|
6764
|
+
}
|
|
6765
|
+
|
|
6766
|
+
.butex-widget .matrix-grid-picker {
|
|
6767
|
+
display: grid;
|
|
6768
|
+
grid-template-columns: repeat(8, 16px);
|
|
6769
|
+
grid-auto-rows: 16px;
|
|
6770
|
+
gap: 3px;
|
|
6771
|
+
justify-content: center;
|
|
6772
|
+
margin-bottom: 7px;
|
|
6773
|
+
}
|
|
6774
|
+
|
|
6775
|
+
.butex-widget .toolbar .matrix-grid-cell {
|
|
6776
|
+
width: 16px;
|
|
6777
|
+
height: 16px;
|
|
6778
|
+
min-width: 0;
|
|
6779
|
+
padding: 0;
|
|
6780
|
+
border-radius: 3px;
|
|
6781
|
+
border-color: var(--butex-border);
|
|
6782
|
+
}
|
|
6783
|
+
|
|
6784
|
+
.butex-widget .toolbar .matrix-grid-cell.active {
|
|
6785
|
+
border-color: var(--butex-toolbar-hover-border);
|
|
6786
|
+
background: var(--butex-toolbar-hover-bg);
|
|
6787
|
+
}
|
|
6788
|
+
|
|
6789
|
+
.butex-widget .matrix-custom-size {
|
|
6790
|
+
justify-content: center;
|
|
6791
|
+
margin-bottom: 7px;
|
|
6792
|
+
}
|
|
6793
|
+
|
|
6794
|
+
.butex-widget .matrix-custom-size label {
|
|
6795
|
+
display: inline-flex;
|
|
6796
|
+
align-items: center;
|
|
6797
|
+
gap: 3px;
|
|
6798
|
+
font-size: 11px;
|
|
6799
|
+
color: var(--butex-muted);
|
|
6800
|
+
}
|
|
6801
|
+
|
|
6802
|
+
.butex-widget .matrix-custom-size input {
|
|
6803
|
+
width: 42px;
|
|
6804
|
+
height: 24px;
|
|
6805
|
+
border: 1px solid var(--butex-border);
|
|
6806
|
+
border-radius: 6px;
|
|
6807
|
+
padding: 0 4px;
|
|
6808
|
+
direction: ltr;
|
|
6809
|
+
}
|
|
6810
|
+
|
|
6811
|
+
.butex-widget .matrix-edit-actions {
|
|
6812
|
+
justify-content: center;
|
|
6813
|
+
border-top: 1px solid var(--butex-border);
|
|
6814
|
+
padding-top: 7px;
|
|
6815
|
+
}
|
|
6816
|
+
|
|
6817
|
+
.butex-widget .butex-widget__mobile-matrix-picker {
|
|
6818
|
+
display: grid;
|
|
6819
|
+
gap: 14px;
|
|
6820
|
+
min-width: 0;
|
|
6821
|
+
}
|
|
6822
|
+
|
|
6823
|
+
.butex-widget .butex-widget__matrix-presets {
|
|
6824
|
+
display: grid;
|
|
6825
|
+
gap: 8px;
|
|
6826
|
+
grid-template-columns: repeat(4, minmax(44px, 1fr));
|
|
6827
|
+
}
|
|
6828
|
+
|
|
6829
|
+
.butex-widget .butex-widget__matrix-stepper-row {
|
|
6830
|
+
align-items: center;
|
|
6831
|
+
display: flex;
|
|
6832
|
+
gap: 12px;
|
|
6833
|
+
justify-content: space-between;
|
|
6834
|
+
}
|
|
6835
|
+
|
|
6836
|
+
.butex-widget .butex-widget__matrix-stepper {
|
|
6837
|
+
align-items: center;
|
|
6838
|
+
direction: ltr;
|
|
6839
|
+
display: grid;
|
|
6840
|
+
gap: 8px;
|
|
6841
|
+
grid-template-columns: 44px minmax(42px, auto) 44px;
|
|
6842
|
+
}
|
|
6843
|
+
|
|
6844
|
+
.butex-widget .butex-widget__matrix-stepper output {
|
|
6845
|
+
font-variant-numeric: tabular-nums;
|
|
6846
|
+
font-weight: 700;
|
|
6847
|
+
text-align: center;
|
|
6848
|
+
}
|
|
6849
|
+
|
|
6850
|
+
.butex-widget .butex-widget__matrix-size-summary {
|
|
6851
|
+
color: var(--butex-muted);
|
|
6852
|
+
direction: ltr;
|
|
6853
|
+
margin: 0;
|
|
6854
|
+
text-align: center;
|
|
6855
|
+
}
|
|
6856
|
+
|
|
6857
|
+
.butex-widget .butex-widget__matrix-insert {
|
|
6858
|
+
background: var(--butex-accent-hover);
|
|
6859
|
+
border-color: var(--butex-accent-hover);
|
|
6860
|
+
color: var(--butex-on-accent);
|
|
6861
|
+
width: 100%;
|
|
6862
|
+
}
|
|
6863
|
+
|
|
6864
|
+
.butex-widget .butex-widget__matrix-alignment {
|
|
6865
|
+
align-items: center;
|
|
6866
|
+
display: flex;
|
|
6867
|
+
flex-wrap: wrap;
|
|
6868
|
+
gap: 8px;
|
|
6869
|
+
}
|
|
6870
|
+
|
|
6871
|
+
.butex-widget .butex-widget__matrix-alignment label {
|
|
6872
|
+
align-items: center;
|
|
6873
|
+
display: inline-flex;
|
|
6874
|
+
gap: 6px;
|
|
6875
|
+
}
|
|
6876
|
+
|
|
6877
|
+
.butex-widget .butex-widget__matrix-alignment input {
|
|
6878
|
+
border: 1px solid var(--butex-border);
|
|
6879
|
+
border-radius: 8px;
|
|
6880
|
+
min-height: 44px;
|
|
6881
|
+
padding-inline: 8px;
|
|
6882
|
+
width: 70px;
|
|
6883
|
+
}
|
|
6884
|
+
`.trim();
|
|
6885
|
+
|
|
6603
6886
|
// src/react/widgetChromeCss.ts
|
|
6604
6887
|
var WIDGET_CHROME_CSS = `
|
|
6605
6888
|
.butex-widget {
|
|
@@ -6646,9 +6929,22 @@ var WIDGET_CHROME_CSS = `
|
|
|
6646
6929
|
--butex-script-color: #475569;
|
|
6647
6930
|
--butex-delim-color: #475569;
|
|
6648
6931
|
--butex-frac-bar: currentColor;
|
|
6932
|
+
--butex-z-popover: 10;
|
|
6933
|
+
box-sizing: border-box;
|
|
6649
6934
|
font-family: ui-sans-serif, system-ui, "Segoe UI", Tahoma, Arial, sans-serif;
|
|
6650
6935
|
color: var(--butex-fg);
|
|
6936
|
+
container-name: butex-equation;
|
|
6937
|
+
container-type: inline-size;
|
|
6651
6938
|
line-height: 1.45;
|
|
6939
|
+
max-width: 100%;
|
|
6940
|
+
min-width: 0;
|
|
6941
|
+
width: 100%;
|
|
6942
|
+
}
|
|
6943
|
+
|
|
6944
|
+
.butex-widget *,
|
|
6945
|
+
.butex-widget *::before,
|
|
6946
|
+
.butex-widget *::after {
|
|
6947
|
+
box-sizing: inherit;
|
|
6652
6948
|
}
|
|
6653
6949
|
|
|
6654
6950
|
.butex-widget .butex-widget-layout {
|
|
@@ -6657,12 +6953,16 @@ var WIDGET_CHROME_CSS = `
|
|
|
6657
6953
|
gap: 8px;
|
|
6658
6954
|
max-width: 920px;
|
|
6659
6955
|
margin: 0 auto;
|
|
6956
|
+
min-width: 0;
|
|
6957
|
+
width: 100%;
|
|
6660
6958
|
}
|
|
6661
6959
|
|
|
6662
6960
|
.butex-widget .panel {
|
|
6663
6961
|
background: var(--butex-panel);
|
|
6664
6962
|
border: 1px solid var(--butex-border);
|
|
6665
6963
|
border-radius: 14px;
|
|
6964
|
+
max-width: 100%;
|
|
6965
|
+
min-width: 0;
|
|
6666
6966
|
padding: 12px 14px;
|
|
6667
6967
|
box-shadow: var(--butex-shadow-md);
|
|
6668
6968
|
}
|
|
@@ -6695,23 +6995,193 @@ var WIDGET_CHROME_CSS = `
|
|
|
6695
6995
|
margin-bottom: 8px;
|
|
6696
6996
|
align-items: center;
|
|
6697
6997
|
align-content: flex-start;
|
|
6998
|
+
min-width: 0;
|
|
6999
|
+
position: relative;
|
|
6698
7000
|
}
|
|
6699
7001
|
|
|
6700
|
-
.butex-widget .toolbar
|
|
7002
|
+
.butex-widget .butex-widget__mobile-toolbar,
|
|
7003
|
+
.butex-widget .butex-widget__mobile-preview-toggle,
|
|
7004
|
+
.butex-widget .butex-widget__command-sheet-backdrop {
|
|
7005
|
+
display: none;
|
|
7006
|
+
}
|
|
7007
|
+
|
|
7008
|
+
.butex-widget .butex-widget__mobile-toolbar {
|
|
7009
|
+
background: var(--butex-panel);
|
|
7010
|
+
gap: 4px;
|
|
7011
|
+
grid-template-columns: repeat(8, minmax(44px, 1fr));
|
|
7012
|
+
margin-bottom: 8px;
|
|
7013
|
+
min-width: 0;
|
|
7014
|
+
position: sticky;
|
|
7015
|
+
top: 0;
|
|
7016
|
+
z-index: 1;
|
|
7017
|
+
}
|
|
7018
|
+
|
|
7019
|
+
.butex-widget .butex-widget__mobile-toolbar button,
|
|
7020
|
+
.butex-widget .butex-widget__mobile-preview-toggle,
|
|
7021
|
+
.butex-widget .butex-widget__command-sheet button {
|
|
7022
|
+
align-items: center;
|
|
7023
|
+
background: var(--butex-panel);
|
|
6701
7024
|
border: 1px solid var(--butex-border);
|
|
6702
7025
|
border-radius: 9px;
|
|
6703
|
-
background: var(--butex-panel);
|
|
6704
7026
|
color: var(--butex-fg);
|
|
6705
|
-
min-width: 30px;
|
|
6706
|
-
height: 30px;
|
|
6707
|
-
padding: 0 7px;
|
|
6708
|
-
font-size: 12px;
|
|
6709
|
-
font-weight: 600;
|
|
6710
7027
|
cursor: pointer;
|
|
6711
7028
|
display: inline-flex;
|
|
6712
|
-
|
|
7029
|
+
font: inherit;
|
|
7030
|
+
font-size: 13px;
|
|
7031
|
+
font-weight: 600;
|
|
6713
7032
|
justify-content: center;
|
|
6714
|
-
|
|
7033
|
+
min-height: 44px;
|
|
7034
|
+
min-width: 44px;
|
|
7035
|
+
padding: 6px 9px;
|
|
7036
|
+
}
|
|
7037
|
+
|
|
7038
|
+
.butex-widget .butex-widget__mobile-preview-toggle {
|
|
7039
|
+
display: none;
|
|
7040
|
+
}
|
|
7041
|
+
|
|
7042
|
+
.butex-widget .butex-widget__mobile-toolbar button:disabled,
|
|
7043
|
+
.butex-widget .butex-widget__command-sheet button:disabled {
|
|
7044
|
+
cursor: not-allowed;
|
|
7045
|
+
opacity: 0.42;
|
|
7046
|
+
}
|
|
7047
|
+
|
|
7048
|
+
.butex-widget .butex-widget__mobile-toolbar button:focus-visible,
|
|
7049
|
+
.butex-widget .butex-widget__mobile-preview-toggle:focus-visible,
|
|
7050
|
+
.butex-widget .butex-widget__command-sheet button:focus-visible {
|
|
7051
|
+
border-color: var(--butex-accent);
|
|
7052
|
+
box-shadow: 0 0 0 3px var(--butex-focus-shadow);
|
|
7053
|
+
outline: none;
|
|
7054
|
+
}
|
|
7055
|
+
|
|
7056
|
+
.butex-widget .butex-widget__mobile-toolbar button[aria-expanded="true"],
|
|
7057
|
+
.butex-widget .butex-widget__mobile-preview-toggle[aria-expanded="true"],
|
|
7058
|
+
.butex-widget .butex-widget__command-sheet button[aria-pressed="true"],
|
|
7059
|
+
.butex-widget .butex-widget__command-sheet button[aria-selected="true"] {
|
|
7060
|
+
background: var(--butex-toolbar-hover-bg);
|
|
7061
|
+
border-color: var(--butex-toolbar-hover-border);
|
|
7062
|
+
box-shadow: 0 0 0 2px var(--butex-focus-shadow);
|
|
7063
|
+
}
|
|
7064
|
+
|
|
7065
|
+
.butex-widget .butex-widget__mobile-danger {
|
|
7066
|
+
color: var(--butex-danger);
|
|
7067
|
+
}
|
|
7068
|
+
|
|
7069
|
+
.butex-widget .butex-widget__mobile-preview-toggle {
|
|
7070
|
+
align-self: flex-start;
|
|
7071
|
+
margin-top: 8px;
|
|
7072
|
+
}
|
|
7073
|
+
|
|
7074
|
+
.butex-widget .butex-widget__command-sheet-backdrop {
|
|
7075
|
+
align-items: flex-end;
|
|
7076
|
+
background: rgba(15, 23, 42, 0.38);
|
|
7077
|
+
inset: 0;
|
|
7078
|
+
justify-content: center;
|
|
7079
|
+
padding-bottom: var(--butex-safe-area-bottom, env(safe-area-inset-bottom, 0px));
|
|
7080
|
+
padding-left: max(12px, var(--butex-safe-area-left, env(safe-area-inset-left, 0px)));
|
|
7081
|
+
padding-right: max(12px, var(--butex-safe-area-right, env(safe-area-inset-right, 0px)));
|
|
7082
|
+
padding-top: max(12px, var(--butex-safe-area-top, env(safe-area-inset-top, 0px)));
|
|
7083
|
+
position: fixed;
|
|
7084
|
+
z-index: var(--butex-z-popover);
|
|
7085
|
+
}
|
|
7086
|
+
|
|
7087
|
+
.butex-widget .butex-widget__command-sheet {
|
|
7088
|
+
background: var(--butex-panel);
|
|
7089
|
+
border: 1px solid var(--butex-border);
|
|
7090
|
+
border-radius: 16px 16px 0 0;
|
|
7091
|
+
box-shadow: 0 -18px 48px rgba(15, 23, 42, 0.22);
|
|
7092
|
+
display: grid;
|
|
7093
|
+
grid-template-rows: auto minmax(0, 1fr);
|
|
7094
|
+
max-height: min(78vh, 720px);
|
|
7095
|
+
max-height: min(720px, calc(100dvh - max(12px, var(--butex-safe-area-top, env(safe-area-inset-top, 0px))) - var(--butex-safe-area-bottom, env(safe-area-inset-bottom, 0px))));
|
|
7096
|
+
max-width: 640px;
|
|
7097
|
+
min-width: 0;
|
|
7098
|
+
overflow: hidden;
|
|
7099
|
+
width: 100%;
|
|
7100
|
+
}
|
|
7101
|
+
|
|
7102
|
+
.butex-widget .butex-widget__command-sheet-header {
|
|
7103
|
+
align-items: center;
|
|
7104
|
+
border-bottom: 1px solid var(--butex-border);
|
|
7105
|
+
display: grid;
|
|
7106
|
+
gap: 8px;
|
|
7107
|
+
grid-template-columns: minmax(44px, auto) minmax(0, 1fr) minmax(44px, auto);
|
|
7108
|
+
padding: 10px 12px;
|
|
7109
|
+
text-align: center;
|
|
7110
|
+
}
|
|
7111
|
+
|
|
7112
|
+
.butex-widget .butex-widget__command-sheet-header strong {
|
|
7113
|
+
overflow-wrap: anywhere;
|
|
7114
|
+
}
|
|
7115
|
+
|
|
7116
|
+
.butex-widget .butex-widget__command-sheet-body {
|
|
7117
|
+
display: grid;
|
|
7118
|
+
gap: 14px;
|
|
7119
|
+
min-height: 0;
|
|
7120
|
+
min-width: 0;
|
|
7121
|
+
overflow-y: auto;
|
|
7122
|
+
overscroll-behavior: contain;
|
|
7123
|
+
padding: 12px;
|
|
7124
|
+
}
|
|
7125
|
+
|
|
7126
|
+
.butex-widget .butex-widget__sheet-section {
|
|
7127
|
+
display: grid;
|
|
7128
|
+
gap: 8px;
|
|
7129
|
+
min-width: 0;
|
|
7130
|
+
}
|
|
7131
|
+
|
|
7132
|
+
.butex-widget .butex-widget__sheet-section h4 {
|
|
7133
|
+
font-size: 13px;
|
|
7134
|
+
margin: 0;
|
|
7135
|
+
}
|
|
7136
|
+
|
|
7137
|
+
.butex-widget .butex-widget__sheet-categories,
|
|
7138
|
+
.butex-widget .butex-widget__sheet-command-grid,
|
|
7139
|
+
.butex-widget .butex-widget__sheet-command-list,
|
|
7140
|
+
.butex-widget .butex-widget__sheet-choice-row {
|
|
7141
|
+
display: grid;
|
|
7142
|
+
gap: 8px;
|
|
7143
|
+
min-width: 0;
|
|
7144
|
+
}
|
|
7145
|
+
|
|
7146
|
+
.butex-widget .butex-widget__sheet-categories,
|
|
7147
|
+
.butex-widget .butex-widget__sheet-command-grid {
|
|
7148
|
+
grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
|
|
7149
|
+
}
|
|
7150
|
+
|
|
7151
|
+
.butex-widget .butex-widget__sheet-command-grid--three,
|
|
7152
|
+
.butex-widget .butex-widget__sheet-choice-row {
|
|
7153
|
+
grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
|
|
7154
|
+
}
|
|
7155
|
+
|
|
7156
|
+
.butex-widget .butex-widget__sheet-categories button,
|
|
7157
|
+
.butex-widget .butex-widget__sheet-command-list button {
|
|
7158
|
+
justify-content: flex-start;
|
|
7159
|
+
overflow-wrap: anywhere;
|
|
7160
|
+
text-align: start;
|
|
7161
|
+
}
|
|
7162
|
+
|
|
7163
|
+
.butex-widget .butex-widget__command-sheet .operator-command-svg-label {
|
|
7164
|
+
background-color: currentColor;
|
|
7165
|
+
display: inline-block;
|
|
7166
|
+
height: 22px;
|
|
7167
|
+
width: 22px;
|
|
7168
|
+
}
|
|
7169
|
+
|
|
7170
|
+
.butex-widget .toolbar button {
|
|
7171
|
+
border: 1px solid var(--butex-border);
|
|
7172
|
+
border-radius: 9px;
|
|
7173
|
+
background: var(--butex-panel);
|
|
7174
|
+
color: var(--butex-fg);
|
|
7175
|
+
min-width: 30px;
|
|
7176
|
+
height: 30px;
|
|
7177
|
+
padding: 0 7px;
|
|
7178
|
+
font-size: 12px;
|
|
7179
|
+
font-weight: 600;
|
|
7180
|
+
cursor: pointer;
|
|
7181
|
+
display: inline-flex;
|
|
7182
|
+
align-items: center;
|
|
7183
|
+
justify-content: center;
|
|
7184
|
+
line-height: 1;
|
|
6715
7185
|
transition: transform 0.14s ease, border-color 0.14s ease, background 0.14s ease, color 0.14s ease;
|
|
6716
7186
|
}
|
|
6717
7187
|
|
|
@@ -6762,7 +7232,7 @@ var WIDGET_CHROME_CSS = `
|
|
|
6762
7232
|
|
|
6763
7233
|
.butex-widget .delimiter-command-options {
|
|
6764
7234
|
position: absolute;
|
|
6765
|
-
z-index:
|
|
7235
|
+
z-index: var(--butex-z-popover);
|
|
6766
7236
|
top: calc(100% + 5px);
|
|
6767
7237
|
right: 0;
|
|
6768
7238
|
left: auto;
|
|
@@ -6841,133 +7311,7 @@ var WIDGET_CHROME_CSS = `
|
|
|
6841
7311
|
opacity: 0.85;
|
|
6842
7312
|
}
|
|
6843
7313
|
|
|
6844
|
-
|
|
6845
|
-
position: relative;
|
|
6846
|
-
display: inline-flex;
|
|
6847
|
-
}
|
|
6848
|
-
|
|
6849
|
-
.butex-widget .matrix-command-btn::after {
|
|
6850
|
-
content: "";
|
|
6851
|
-
width: 0;
|
|
6852
|
-
height: 0;
|
|
6853
|
-
margin-inline-start: 3px;
|
|
6854
|
-
border-inline: 3px solid transparent;
|
|
6855
|
-
border-block-start: 4px solid currentColor;
|
|
6856
|
-
opacity: 0.72;
|
|
6857
|
-
}
|
|
6858
|
-
|
|
6859
|
-
.butex-widget .toolbar-matrix-icon {
|
|
6860
|
-
width: 14px;
|
|
6861
|
-
height: 14px;
|
|
6862
|
-
display: grid;
|
|
6863
|
-
grid-template-columns: repeat(2, 1fr);
|
|
6864
|
-
gap: 2px;
|
|
6865
|
-
}
|
|
6866
|
-
|
|
6867
|
-
.butex-widget .toolbar-matrix-icon span {
|
|
6868
|
-
border: 1px solid currentColor;
|
|
6869
|
-
border-radius: 2px;
|
|
6870
|
-
}
|
|
6871
|
-
|
|
6872
|
-
.butex-widget .matrix-command-popover {
|
|
6873
|
-
position: absolute;
|
|
6874
|
-
z-index: 12;
|
|
6875
|
-
top: calc(100% + 5px);
|
|
6876
|
-
right: 0;
|
|
6877
|
-
width: 252px;
|
|
6878
|
-
padding: 8px;
|
|
6879
|
-
border: 1px solid var(--butex-border);
|
|
6880
|
-
border-radius: 9px;
|
|
6881
|
-
background: var(--butex-panel);
|
|
6882
|
-
color: var(--butex-fg);
|
|
6883
|
-
box-shadow: var(--butex-shadow-md);
|
|
6884
|
-
}
|
|
6885
|
-
|
|
6886
|
-
.butex-widget .matrix-command-popover[hidden] {
|
|
6887
|
-
display: none;
|
|
6888
|
-
}
|
|
6889
|
-
|
|
6890
|
-
.butex-widget .matrix-style-options,
|
|
6891
|
-
.butex-widget .matrix-edit-actions,
|
|
6892
|
-
.butex-widget .matrix-custom-size {
|
|
6893
|
-
display: flex;
|
|
6894
|
-
gap: 5px;
|
|
6895
|
-
align-items: center;
|
|
6896
|
-
flex-wrap: wrap;
|
|
6897
|
-
}
|
|
6898
|
-
|
|
6899
|
-
.butex-widget .toolbar .matrix-style-option,
|
|
6900
|
-
.butex-widget .toolbar .matrix-edit-actions button,
|
|
6901
|
-
.butex-widget .toolbar .matrix-insert-custom {
|
|
6902
|
-
height: 26px;
|
|
6903
|
-
min-width: 30px;
|
|
6904
|
-
padding: 0 6px;
|
|
6905
|
-
border-radius: 7px;
|
|
6906
|
-
}
|
|
6907
|
-
|
|
6908
|
-
.butex-widget .toolbar .matrix-style-option[aria-selected="true"] {
|
|
6909
|
-
border-color: var(--butex-toolbar-hover-border);
|
|
6910
|
-
background: var(--butex-toolbar-hover-bg);
|
|
6911
|
-
}
|
|
6912
|
-
|
|
6913
|
-
.butex-widget .matrix-size-readout {
|
|
6914
|
-
margin: 7px 0 5px;
|
|
6915
|
-
font-size: 12px;
|
|
6916
|
-
color: var(--butex-muted);
|
|
6917
|
-
text-align: center;
|
|
6918
|
-
direction: ltr;
|
|
6919
|
-
}
|
|
6920
|
-
|
|
6921
|
-
.butex-widget .matrix-grid-picker {
|
|
6922
|
-
display: grid;
|
|
6923
|
-
grid-template-columns: repeat(8, 16px);
|
|
6924
|
-
grid-auto-rows: 16px;
|
|
6925
|
-
gap: 3px;
|
|
6926
|
-
justify-content: center;
|
|
6927
|
-
margin-bottom: 7px;
|
|
6928
|
-
}
|
|
6929
|
-
|
|
6930
|
-
.butex-widget .toolbar .matrix-grid-cell {
|
|
6931
|
-
width: 16px;
|
|
6932
|
-
height: 16px;
|
|
6933
|
-
min-width: 0;
|
|
6934
|
-
padding: 0;
|
|
6935
|
-
border-radius: 3px;
|
|
6936
|
-
border-color: var(--butex-border);
|
|
6937
|
-
}
|
|
6938
|
-
|
|
6939
|
-
.butex-widget .toolbar .matrix-grid-cell.active {
|
|
6940
|
-
border-color: var(--butex-toolbar-hover-border);
|
|
6941
|
-
background: var(--butex-toolbar-hover-bg);
|
|
6942
|
-
}
|
|
6943
|
-
|
|
6944
|
-
.butex-widget .matrix-custom-size {
|
|
6945
|
-
justify-content: center;
|
|
6946
|
-
margin-bottom: 7px;
|
|
6947
|
-
}
|
|
6948
|
-
|
|
6949
|
-
.butex-widget .matrix-custom-size label {
|
|
6950
|
-
display: inline-flex;
|
|
6951
|
-
align-items: center;
|
|
6952
|
-
gap: 3px;
|
|
6953
|
-
font-size: 11px;
|
|
6954
|
-
color: var(--butex-muted);
|
|
6955
|
-
}
|
|
6956
|
-
|
|
6957
|
-
.butex-widget .matrix-custom-size input {
|
|
6958
|
-
width: 42px;
|
|
6959
|
-
height: 24px;
|
|
6960
|
-
border: 1px solid var(--butex-border);
|
|
6961
|
-
border-radius: 6px;
|
|
6962
|
-
padding: 0 4px;
|
|
6963
|
-
direction: ltr;
|
|
6964
|
-
}
|
|
6965
|
-
|
|
6966
|
-
.butex-widget .matrix-edit-actions {
|
|
6967
|
-
justify-content: center;
|
|
6968
|
-
border-top: 1px solid var(--butex-border);
|
|
6969
|
-
padding-top: 7px;
|
|
6970
|
-
}
|
|
7314
|
+
${MATRIX_PICKER_CSS}
|
|
6971
7315
|
|
|
6972
7316
|
.butex-widget .script-icon-btn {
|
|
6973
7317
|
min-width: 32px;
|
|
@@ -7003,28 +7347,32 @@ var WIDGET_CHROME_CSS = `
|
|
|
7003
7347
|
}
|
|
7004
7348
|
|
|
7005
7349
|
.butex-widget .font-mode-btn--takween,
|
|
7006
|
-
.butex-widget .character-font-option--takween
|
|
7350
|
+
.butex-widget .character-font-option--takween,
|
|
7351
|
+
.butex-widget .butex-widget__command-sheet .character-font-option--takween {
|
|
7007
7352
|
font-family: ${BUTEX_TAKWEEN_FONT_STACK};
|
|
7008
7353
|
}
|
|
7009
7354
|
|
|
7010
7355
|
.butex-widget .font-mode-btn--diwani,
|
|
7011
|
-
.butex-widget .character-font-option--diwani
|
|
7356
|
+
.butex-widget .character-font-option--diwani,
|
|
7357
|
+
.butex-widget .butex-widget__command-sheet .character-font-option--diwani {
|
|
7012
7358
|
font-family: ${BUTEX_DIWANI_FONT_STACK};
|
|
7013
7359
|
}
|
|
7014
7360
|
|
|
7015
7361
|
.butex-widget .font-mode-btn--diwaniOutline,
|
|
7016
|
-
.butex-widget .character-font-option--diwaniOutline
|
|
7362
|
+
.butex-widget .character-font-option--diwaniOutline,
|
|
7363
|
+
.butex-widget .butex-widget__command-sheet .character-font-option--diwaniOutline {
|
|
7017
7364
|
font-family: ${BUTEX_DIWANI_OUTLINE_FONT_STACK};
|
|
7018
7365
|
}
|
|
7019
7366
|
|
|
7020
7367
|
.butex-widget .font-mode-btn--maghribi,
|
|
7021
|
-
.butex-widget .character-font-option--maghribi
|
|
7368
|
+
.butex-widget .character-font-option--maghribi,
|
|
7369
|
+
.butex-widget .butex-widget__command-sheet .character-font-option--maghribi {
|
|
7022
7370
|
font-family: ${BUTEX_MAGHRIBI_FONT_STACK};
|
|
7023
7371
|
}
|
|
7024
7372
|
|
|
7025
7373
|
.butex-widget .character-font-options {
|
|
7026
7374
|
position: absolute;
|
|
7027
|
-
z-index:
|
|
7375
|
+
z-index: var(--butex-z-popover);
|
|
7028
7376
|
top: calc(100% + 5px);
|
|
7029
7377
|
right: 0;
|
|
7030
7378
|
left: auto;
|
|
@@ -7061,8 +7409,9 @@ var WIDGET_CHROME_CSS = `
|
|
|
7061
7409
|
}
|
|
7062
7410
|
|
|
7063
7411
|
.butex-widget .toolbar .character-font-option[aria-selected="true"] {
|
|
7064
|
-
background:
|
|
7412
|
+
background: var(--butex-accent-hover);
|
|
7065
7413
|
color: var(--butex-on-accent);
|
|
7414
|
+
box-shadow: inset 0 0 0 2px currentColor;
|
|
7066
7415
|
}
|
|
7067
7416
|
|
|
7068
7417
|
.butex-widget .toolbar-script-icon {
|
|
@@ -7152,6 +7501,16 @@ var WIDGET_CHROME_CSS = `
|
|
|
7152
7501
|
font-family: ${BUTEX_DIWANI_OUTLINE_FONT_STACK};
|
|
7153
7502
|
}
|
|
7154
7503
|
|
|
7504
|
+
.butex-widget .butex-widget__command-sheet .function-command-option {
|
|
7505
|
+
direction: rtl;
|
|
7506
|
+
font-family: ${BUTEX_DIWANI_FONT_STACK};
|
|
7507
|
+
font-size: 17px;
|
|
7508
|
+
}
|
|
7509
|
+
|
|
7510
|
+
.butex-widget .butex-widget__command-sheet .function-command-option--outline {
|
|
7511
|
+
font-family: ${BUTEX_DIWANI_OUTLINE_FONT_STACK};
|
|
7512
|
+
}
|
|
7513
|
+
|
|
7155
7514
|
.butex-widget .function-command-btn::after {
|
|
7156
7515
|
content: "";
|
|
7157
7516
|
width: 0;
|
|
@@ -7170,7 +7529,7 @@ var WIDGET_CHROME_CSS = `
|
|
|
7170
7529
|
|
|
7171
7530
|
.butex-widget .function-command-options {
|
|
7172
7531
|
position: absolute;
|
|
7173
|
-
z-index:
|
|
7532
|
+
z-index: var(--butex-z-popover);
|
|
7174
7533
|
top: calc(100% + 5px);
|
|
7175
7534
|
right: 0;
|
|
7176
7535
|
left: auto;
|
|
@@ -7232,6 +7591,11 @@ var WIDGET_CHROME_CSS = `
|
|
|
7232
7591
|
font-family: "Cambria Math", "Times New Roman", serif;
|
|
7233
7592
|
}
|
|
7234
7593
|
|
|
7594
|
+
.butex-widget .butex-widget__command-sheet .operator-command-option {
|
|
7595
|
+
font-family: "Cambria Math", "Times New Roman", serif;
|
|
7596
|
+
font-size: 17px;
|
|
7597
|
+
}
|
|
7598
|
+
|
|
7235
7599
|
.butex-widget .operator-command-label {
|
|
7236
7600
|
display: inline-flex;
|
|
7237
7601
|
align-items: center;
|
|
@@ -7267,7 +7631,7 @@ var WIDGET_CHROME_CSS = `
|
|
|
7267
7631
|
|
|
7268
7632
|
.butex-widget .spacing-command-options {
|
|
7269
7633
|
position: absolute;
|
|
7270
|
-
z-index:
|
|
7634
|
+
z-index: var(--butex-z-popover);
|
|
7271
7635
|
top: calc(100% + 5px);
|
|
7272
7636
|
right: 0;
|
|
7273
7637
|
left: auto;
|
|
@@ -7383,7 +7747,7 @@ var WIDGET_CHROME_CSS = `
|
|
|
7383
7747
|
|
|
7384
7748
|
.butex-widget .digit-form-options {
|
|
7385
7749
|
position: absolute;
|
|
7386
|
-
z-index:
|
|
7750
|
+
z-index: var(--butex-z-popover);
|
|
7387
7751
|
top: calc(100% + 5px);
|
|
7388
7752
|
right: 0;
|
|
7389
7753
|
left: auto;
|
|
@@ -7420,8 +7784,9 @@ var WIDGET_CHROME_CSS = `
|
|
|
7420
7784
|
}
|
|
7421
7785
|
|
|
7422
7786
|
.butex-widget .toolbar .digit-form-option[aria-selected="true"] {
|
|
7423
|
-
background:
|
|
7787
|
+
background: var(--butex-accent-hover);
|
|
7424
7788
|
color: var(--butex-on-accent);
|
|
7789
|
+
box-shadow: inset 0 0 0 2px currentColor;
|
|
7425
7790
|
}
|
|
7426
7791
|
|
|
7427
7792
|
.butex-widget .delete-node-btn,
|
|
@@ -7449,6 +7814,8 @@ var WIDGET_CHROME_CSS = `
|
|
|
7449
7814
|
border: 1px solid var(--butex-border);
|
|
7450
7815
|
border-radius: 10px;
|
|
7451
7816
|
background: rgba(248, 250, 252, 0.72);
|
|
7817
|
+
max-width: 100%;
|
|
7818
|
+
min-width: 0;
|
|
7452
7819
|
}
|
|
7453
7820
|
|
|
7454
7821
|
.butex-widget .toolbar-functions,
|
|
@@ -7457,9 +7824,10 @@ var WIDGET_CHROME_CSS = `
|
|
|
7457
7824
|
}
|
|
7458
7825
|
|
|
7459
7826
|
.butex-widget .toolbar .accent {
|
|
7460
|
-
background:
|
|
7827
|
+
background: var(--butex-accent-hover);
|
|
7461
7828
|
color: var(--butex-on-accent);
|
|
7462
7829
|
border-color: transparent;
|
|
7830
|
+
box-shadow: inset 0 0 0 2px currentColor;
|
|
7463
7831
|
}
|
|
7464
7832
|
|
|
7465
7833
|
.butex-widget .preview-box {
|
|
@@ -7468,7 +7836,13 @@ var WIDGET_CHROME_CSS = `
|
|
|
7468
7836
|
padding: 10px 12px;
|
|
7469
7837
|
background: var(--butex-preview-bg);
|
|
7470
7838
|
color: var(--butex-preview-fg);
|
|
7839
|
+
max-width: 100%;
|
|
7471
7840
|
min-height: 48px;
|
|
7841
|
+
min-width: 0;
|
|
7842
|
+
overflow-x: auto;
|
|
7843
|
+
overflow-y: hidden;
|
|
7844
|
+
overscroll-behavior-inline: contain;
|
|
7845
|
+
touch-action: pan-x pan-y;
|
|
7472
7846
|
}
|
|
7473
7847
|
|
|
7474
7848
|
.butex-widget .error {
|
|
@@ -7586,6 +7960,150 @@ var WIDGET_CHROME_CSS = `
|
|
|
7586
7960
|
padding: 8px 10px;
|
|
7587
7961
|
white-space: pre-wrap;
|
|
7588
7962
|
}
|
|
7963
|
+
|
|
7964
|
+
.butex-widget .delimiter-command-options,
|
|
7965
|
+
.butex-widget .matrix-command-popover,
|
|
7966
|
+
.butex-widget .character-font-options,
|
|
7967
|
+
.butex-widget .function-command-options,
|
|
7968
|
+
.butex-widget .spacing-command-options,
|
|
7969
|
+
.butex-widget .digit-form-options {
|
|
7970
|
+
max-height: min(70vh, 24rem);
|
|
7971
|
+
max-height: min(70dvh, 24rem);
|
|
7972
|
+
max-width: calc(100vw - 24px);
|
|
7973
|
+
max-width: calc(100cqw - 16px);
|
|
7974
|
+
overflow: auto;
|
|
7975
|
+
overscroll-behavior: contain;
|
|
7976
|
+
}
|
|
7977
|
+
|
|
7978
|
+
.butex-widget[data-responsive-mode="compact"] .butex-widget__desktop-toolbar {
|
|
7979
|
+
display: none;
|
|
7980
|
+
}
|
|
7981
|
+
|
|
7982
|
+
.butex-widget[data-responsive-mode="compact"] .butex-widget__mobile-toolbar {
|
|
7983
|
+
display: grid;
|
|
7984
|
+
}
|
|
7985
|
+
|
|
7986
|
+
.butex-widget[data-responsive-mode="compact"] .butex-widget__mobile-preview-toggle {
|
|
7987
|
+
display: inline-flex;
|
|
7988
|
+
}
|
|
7989
|
+
|
|
7990
|
+
.butex-widget[data-responsive-mode="compact"] .butex-widget__command-sheet-backdrop {
|
|
7991
|
+
display: flex;
|
|
7992
|
+
}
|
|
7993
|
+
|
|
7994
|
+
.butex-widget[data-responsive-mode="compact"] .panel-editor {
|
|
7995
|
+
display: flex;
|
|
7996
|
+
flex-direction: column;
|
|
7997
|
+
min-height: min(60dvh, 520px);
|
|
7998
|
+
}
|
|
7999
|
+
|
|
8000
|
+
.butex-widget[data-responsive-mode="compact"] .surface {
|
|
8001
|
+
flex: 1 1 auto;
|
|
8002
|
+
min-height: clamp(180px, 38dvh, 380px);
|
|
8003
|
+
}
|
|
8004
|
+
|
|
8005
|
+
.butex-widget[data-responsive-mode="compact"][data-compact-preview="closed"] .panel-preview {
|
|
8006
|
+
display: none;
|
|
8007
|
+
}
|
|
8008
|
+
|
|
8009
|
+
@media (max-width: 768px) {
|
|
8010
|
+
.butex-widget:not([data-responsive-mode="desktop"]) .butex-widget__desktop-toolbar {
|
|
8011
|
+
display: none;
|
|
8012
|
+
}
|
|
8013
|
+
|
|
8014
|
+
.butex-widget:not([data-responsive-mode="desktop"]) .butex-widget__mobile-toolbar {
|
|
8015
|
+
display: grid;
|
|
8016
|
+
}
|
|
8017
|
+
|
|
8018
|
+
.butex-widget:not([data-responsive-mode="desktop"]) .butex-widget__mobile-preview-toggle {
|
|
8019
|
+
display: inline-flex;
|
|
8020
|
+
}
|
|
8021
|
+
|
|
8022
|
+
.butex-widget:not([data-responsive-mode="desktop"]) .butex-widget__command-sheet-backdrop {
|
|
8023
|
+
display: flex;
|
|
8024
|
+
}
|
|
8025
|
+
|
|
8026
|
+
.butex-widget:not([data-responsive-mode="desktop"]) .panel-editor {
|
|
8027
|
+
display: flex;
|
|
8028
|
+
flex-direction: column;
|
|
8029
|
+
min-height: min(60dvh, 520px);
|
|
8030
|
+
}
|
|
8031
|
+
|
|
8032
|
+
.butex-widget:not([data-responsive-mode="desktop"]) .surface {
|
|
8033
|
+
flex: 1 1 auto;
|
|
8034
|
+
min-height: clamp(180px, 38dvh, 380px);
|
|
8035
|
+
}
|
|
8036
|
+
|
|
8037
|
+
.butex-widget:not([data-responsive-mode="desktop"])[data-compact-preview="closed"] .panel-preview {
|
|
8038
|
+
display: none;
|
|
8039
|
+
}
|
|
8040
|
+
}
|
|
8041
|
+
|
|
8042
|
+
@media (max-width: 430px) {
|
|
8043
|
+
.butex-widget-layout {
|
|
8044
|
+
gap: 6px;
|
|
8045
|
+
}
|
|
8046
|
+
|
|
8047
|
+
.butex-widget .panel {
|
|
8048
|
+
border-radius: 10px;
|
|
8049
|
+
padding: 8px;
|
|
8050
|
+
}
|
|
8051
|
+
|
|
8052
|
+
.butex-widget .toolbar {
|
|
8053
|
+
gap: 4px;
|
|
8054
|
+
}
|
|
8055
|
+
|
|
8056
|
+
.butex-widget:not([data-responsive-mode="desktop"]) .butex-widget__mobile-toolbar {
|
|
8057
|
+
grid-template-columns: repeat(4, minmax(44px, 1fr));
|
|
8058
|
+
}
|
|
8059
|
+
|
|
8060
|
+
.butex-widget:not([data-responsive-mode="desktop"]) .butex-widget__command-sheet-backdrop {
|
|
8061
|
+
padding-bottom: var(--butex-safe-area-bottom, env(safe-area-inset-bottom, 0px));
|
|
8062
|
+
padding-left: var(--butex-safe-area-left, env(safe-area-inset-left, 0px));
|
|
8063
|
+
padding-right: var(--butex-safe-area-right, env(safe-area-inset-right, 0px));
|
|
8064
|
+
padding-top: max(8px, var(--butex-safe-area-top, env(safe-area-inset-top, 0px)));
|
|
8065
|
+
}
|
|
8066
|
+
|
|
8067
|
+
.butex-widget:not([data-responsive-mode="desktop"]) .butex-widget__command-sheet {
|
|
8068
|
+
border-bottom: 0;
|
|
8069
|
+
max-height: calc(100dvh - max(8px, var(--butex-safe-area-top, env(safe-area-inset-top, 0px))) - var(--butex-safe-area-bottom, env(safe-area-inset-bottom, 0px)));
|
|
8070
|
+
max-width: none;
|
|
8071
|
+
}
|
|
8072
|
+
|
|
8073
|
+
.butex-widget:not([data-responsive-mode="desktop"]) .delimiter-command-menu,
|
|
8074
|
+
.butex-widget:not([data-responsive-mode="desktop"]) .matrix-command-menu,
|
|
8075
|
+
.butex-widget:not([data-responsive-mode="desktop"]) .character-font-menu,
|
|
8076
|
+
.butex-widget:not([data-responsive-mode="desktop"]) .function-command-menu,
|
|
8077
|
+
.butex-widget:not([data-responsive-mode="desktop"]) .spacing-command-menu,
|
|
8078
|
+
.butex-widget:not([data-responsive-mode="desktop"]) .digit-form-menu {
|
|
8079
|
+
position: static;
|
|
8080
|
+
}
|
|
8081
|
+
|
|
8082
|
+
.butex-widget:not([data-responsive-mode="desktop"]) .delimiter-command-options,
|
|
8083
|
+
.butex-widget:not([data-responsive-mode="desktop"]) .matrix-command-popover,
|
|
8084
|
+
.butex-widget:not([data-responsive-mode="desktop"]) .character-font-options,
|
|
8085
|
+
.butex-widget:not([data-responsive-mode="desktop"]) .function-command-options,
|
|
8086
|
+
.butex-widget:not([data-responsive-mode="desktop"]) .spacing-command-options,
|
|
8087
|
+
.butex-widget:not([data-responsive-mode="desktop"]) .digit-form-options {
|
|
8088
|
+
left: 8px;
|
|
8089
|
+
max-width: none;
|
|
8090
|
+
min-width: 0;
|
|
8091
|
+
right: 8px;
|
|
8092
|
+
width: auto;
|
|
8093
|
+
}
|
|
8094
|
+
}
|
|
8095
|
+
|
|
8096
|
+
@media (prefers-reduced-motion: reduce) {
|
|
8097
|
+
.butex-widget .toolbar button,
|
|
8098
|
+
.butex-widget .butex-widget__mobile-toolbar button,
|
|
8099
|
+
.butex-widget .butex-widget__mobile-preview-toggle,
|
|
8100
|
+
.butex-widget .butex-widget__command-sheet,
|
|
8101
|
+
.butex-widget .butex-widget__command-sheet button {
|
|
8102
|
+
animation: none;
|
|
8103
|
+
scroll-behavior: auto;
|
|
8104
|
+
transition: none;
|
|
8105
|
+
}
|
|
8106
|
+
}
|
|
7589
8107
|
`.trim();
|
|
7590
8108
|
var CHROME_STYLE_ID = "butex-widget-chrome-css";
|
|
7591
8109
|
function injectWidgetChromeCss(doc) {
|
|
@@ -8568,82 +9086,911 @@ function editorNodeToAstNode(node) {
|
|
|
8568
9086
|
} else {
|
|
8569
9087
|
return { ok: false, reason: `\u0639\u0642\u062F\u0629 \u0631\u064A\u0627\u0636\u064A\u0629 \u063A\u064A\u0631 \u0645\u062F\u0639\u0648\u0645\u0629 \u062D\u0627\u0644\u064A\u0627: ${node.kind}` };
|
|
8570
9088
|
}
|
|
8571
|
-
const scripts = attachAstScripts(node, astNode);
|
|
8572
|
-
return scripts ?? { ok: true, node: astNode };
|
|
9089
|
+
const scripts = attachAstScripts(node, astNode);
|
|
9090
|
+
return scripts ?? { ok: true, node: astNode };
|
|
9091
|
+
}
|
|
9092
|
+
function editorChainToAstChain(chain) {
|
|
9093
|
+
const nodes = [];
|
|
9094
|
+
for (const editorNode of chain.nodes) {
|
|
9095
|
+
const converted = editorNodeToAstNode(editorNode);
|
|
9096
|
+
if (!converted.ok) {
|
|
9097
|
+
return converted;
|
|
9098
|
+
}
|
|
9099
|
+
nodes.push(converted.node);
|
|
9100
|
+
}
|
|
9101
|
+
return { ok: true, chain: new ChainNode(nodes) };
|
|
9102
|
+
}
|
|
9103
|
+
function mathNodeFromEditorSession(session, mathMode = "$", closing = "$") {
|
|
9104
|
+
const converted = editorChainToAstChain(session.englishTree);
|
|
9105
|
+
if (!converted.ok) {
|
|
9106
|
+
return converted;
|
|
9107
|
+
}
|
|
9108
|
+
return {
|
|
9109
|
+
ok: true,
|
|
9110
|
+
math: {
|
|
9111
|
+
nodeType: "MathObject",
|
|
9112
|
+
mathMode,
|
|
9113
|
+
lines: [converted.chain],
|
|
9114
|
+
closing
|
|
9115
|
+
}
|
|
9116
|
+
};
|
|
9117
|
+
}
|
|
9118
|
+
|
|
9119
|
+
// src/debugJson.ts
|
|
9120
|
+
function lineColumnForPosition(text, position) {
|
|
9121
|
+
const before = text.slice(0, Math.max(0, position));
|
|
9122
|
+
const lines = before.split("\n");
|
|
9123
|
+
return {
|
|
9124
|
+
line: lines.length,
|
|
9125
|
+
column: (lines[lines.length - 1]?.length ?? 0) + 1
|
|
9126
|
+
};
|
|
9127
|
+
}
|
|
9128
|
+
function parseJsonDebugInput(text) {
|
|
9129
|
+
try {
|
|
9130
|
+
return { ok: true, value: JSON.parse(text) };
|
|
9131
|
+
} catch (error) {
|
|
9132
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
9133
|
+
const positionMatch = message.match(/position\s+(\d+)/i);
|
|
9134
|
+
if (positionMatch) {
|
|
9135
|
+
const position = Number(positionMatch[1]);
|
|
9136
|
+
if (Number.isFinite(position)) {
|
|
9137
|
+
const location = lineColumnForPosition(text, position);
|
|
9138
|
+
return { ok: false, error: `Invalid JSON at line ${String(location.line)}, column ${String(location.column)}: ${message}` };
|
|
9139
|
+
}
|
|
9140
|
+
}
|
|
9141
|
+
return { ok: false, error: `Invalid JSON: ${message}` };
|
|
9142
|
+
}
|
|
9143
|
+
}
|
|
9144
|
+
|
|
9145
|
+
// src/react/EquationMobileToolbar.tsx
|
|
9146
|
+
import { useEffect as useEffect2, useId, useRef as useRef2, useState } from "react";
|
|
9147
|
+
|
|
9148
|
+
// src/react/dialogFocus.ts
|
|
9149
|
+
import { useEffect, useRef } from "react";
|
|
9150
|
+
var FOCUSABLE_SELECTOR = [
|
|
9151
|
+
'a[href]:not([tabindex="-1"])',
|
|
9152
|
+
'button:not([disabled]):not([tabindex="-1"])',
|
|
9153
|
+
'input:not([disabled]):not([tabindex="-1"])',
|
|
9154
|
+
'select:not([disabled]):not([tabindex="-1"])',
|
|
9155
|
+
'textarea:not([disabled]):not([tabindex="-1"])',
|
|
9156
|
+
'[tabindex]:not([tabindex="-1"])'
|
|
9157
|
+
].join(",");
|
|
9158
|
+
var dialogStateByDocument = /* @__PURE__ */ new WeakMap();
|
|
9159
|
+
function focusableElements(dialog) {
|
|
9160
|
+
return Array.from(dialog.querySelectorAll(FOCUSABLE_SELECTOR)).filter(
|
|
9161
|
+
(element) => {
|
|
9162
|
+
if (element.hidden || element.closest('[hidden], [aria-hidden="true"], [inert]') || typeof element.checkVisibility === "function" && !element.checkVisibility()) {
|
|
9163
|
+
return false;
|
|
9164
|
+
}
|
|
9165
|
+
return true;
|
|
9166
|
+
}
|
|
9167
|
+
);
|
|
9168
|
+
}
|
|
9169
|
+
function useDialogFocus({ open, dialogRef, onClose, triggerRef }) {
|
|
9170
|
+
const closeRef = useRef(onClose);
|
|
9171
|
+
closeRef.current = onClose;
|
|
9172
|
+
useEffect(() => {
|
|
9173
|
+
if (!open) {
|
|
9174
|
+
return;
|
|
9175
|
+
}
|
|
9176
|
+
const doc = dialogRef.current?.ownerDocument ?? document;
|
|
9177
|
+
const view = doc.defaultView ?? window;
|
|
9178
|
+
const registration = /* @__PURE__ */ Symbol("butex-dialog");
|
|
9179
|
+
const previouslyFocused = doc.activeElement instanceof HTMLElement ? doc.activeElement : null;
|
|
9180
|
+
const documentState = dialogStateByDocument.get(doc) ?? { stack: [], origin: null };
|
|
9181
|
+
if (documentState.stack.length === 0 && documentState.origin === null) {
|
|
9182
|
+
documentState.origin = triggerRef?.current ?? previouslyFocused;
|
|
9183
|
+
}
|
|
9184
|
+
documentState.stack.push(registration);
|
|
9185
|
+
dialogStateByDocument.set(doc, documentState);
|
|
9186
|
+
const focusTimer = view.setTimeout(() => {
|
|
9187
|
+
const initialFocus = dialogRef.current?.querySelector("[data-dialog-initial-focus]") ?? (dialogRef.current ? focusableElements(dialogRef.current)[0] : null) ?? dialogRef.current;
|
|
9188
|
+
initialFocus?.focus();
|
|
9189
|
+
}, 0);
|
|
9190
|
+
const onKeyDown = (event) => {
|
|
9191
|
+
if (documentState.stack.at(-1) !== registration) {
|
|
9192
|
+
return;
|
|
9193
|
+
}
|
|
9194
|
+
if (event.key === "Escape") {
|
|
9195
|
+
event.preventDefault();
|
|
9196
|
+
closeRef.current();
|
|
9197
|
+
return;
|
|
9198
|
+
}
|
|
9199
|
+
if (event.key !== "Tab" || !dialogRef.current) {
|
|
9200
|
+
return;
|
|
9201
|
+
}
|
|
9202
|
+
const focusable = focusableElements(dialogRef.current);
|
|
9203
|
+
if (focusable.length === 0) {
|
|
9204
|
+
event.preventDefault();
|
|
9205
|
+
dialogRef.current.focus();
|
|
9206
|
+
return;
|
|
9207
|
+
}
|
|
9208
|
+
const first = focusable[0];
|
|
9209
|
+
const last = focusable[focusable.length - 1];
|
|
9210
|
+
if (event.shiftKey && (doc.activeElement === first || !dialogRef.current.contains(doc.activeElement))) {
|
|
9211
|
+
event.preventDefault();
|
|
9212
|
+
last?.focus();
|
|
9213
|
+
} else if (!event.shiftKey && doc.activeElement === last) {
|
|
9214
|
+
event.preventDefault();
|
|
9215
|
+
first?.focus();
|
|
9216
|
+
}
|
|
9217
|
+
};
|
|
9218
|
+
const onFocusIn = (event) => {
|
|
9219
|
+
if (documentState.stack.at(-1) !== registration || !dialogRef.current || dialogRef.current.contains(event.target)) {
|
|
9220
|
+
return;
|
|
9221
|
+
}
|
|
9222
|
+
(focusableElements(dialogRef.current)[0] ?? dialogRef.current).focus();
|
|
9223
|
+
};
|
|
9224
|
+
doc.addEventListener("keydown", onKeyDown);
|
|
9225
|
+
doc.addEventListener("focusin", onFocusIn);
|
|
9226
|
+
return () => {
|
|
9227
|
+
view.clearTimeout(focusTimer);
|
|
9228
|
+
doc.removeEventListener("keydown", onKeyDown);
|
|
9229
|
+
doc.removeEventListener("focusin", onFocusIn);
|
|
9230
|
+
const index = documentState.stack.lastIndexOf(registration);
|
|
9231
|
+
const hadParentDialog = index > 0;
|
|
9232
|
+
if (index >= 0) {
|
|
9233
|
+
documentState.stack.splice(index, 1);
|
|
9234
|
+
}
|
|
9235
|
+
view.setTimeout(() => {
|
|
9236
|
+
if (documentState.stack.length > 0 && !hadParentDialog) {
|
|
9237
|
+
return;
|
|
9238
|
+
}
|
|
9239
|
+
const restoreTarget = [triggerRef?.current, previouslyFocused, documentState.origin].find(
|
|
9240
|
+
(candidate) => Boolean(candidate?.isConnected)
|
|
9241
|
+
);
|
|
9242
|
+
if (restoreTarget) {
|
|
9243
|
+
restoreTarget.focus();
|
|
9244
|
+
}
|
|
9245
|
+
if (documentState.stack.length === 0) {
|
|
9246
|
+
view.setTimeout(() => {
|
|
9247
|
+
if (documentState.stack.length === 0 && dialogStateByDocument.get(doc) === documentState) {
|
|
9248
|
+
dialogStateByDocument.delete(doc);
|
|
9249
|
+
}
|
|
9250
|
+
}, 0);
|
|
9251
|
+
}
|
|
9252
|
+
}, 0);
|
|
9253
|
+
};
|
|
9254
|
+
}, [dialogRef, open, triggerRef]);
|
|
9255
|
+
}
|
|
9256
|
+
|
|
9257
|
+
// src/react/EquationMobileToolbar.tsx
|
|
9258
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
9259
|
+
var ACCENT_COMMANDS2 = accentCommandsList();
|
|
9260
|
+
var FUNCTION_COMMANDS = atomicCommandsByCategory("function");
|
|
9261
|
+
var LIMITS_SERIES_COMMANDS = atomicCommandsByCategory("limits_series");
|
|
9262
|
+
var FUNCTION2_COMMANDS = atomicCommandsByCategory("function2");
|
|
9263
|
+
var DERIVATIVE_COMMANDS = atomicCommandsByCategory("derivative");
|
|
9264
|
+
var GROUP_COMMANDS = atomicCommandsByCategory("groups");
|
|
9265
|
+
var SPACING_COMMANDS = atomicCommandsByCategory("spacing").filter(isSpacingCommandSpec);
|
|
9266
|
+
var OPERATOR_GROUPS = [
|
|
9267
|
+
atomicOperatorCommandsByCategory("operators1"),
|
|
9268
|
+
atomicOperatorCommandsByCategory("operators2"),
|
|
9269
|
+
atomicOperatorCommandsByCategory("operators3"),
|
|
9270
|
+
atomicOperatorCommandsByCategory("dots"),
|
|
9271
|
+
atomicOperatorCommandsByCategory("integrals")
|
|
9272
|
+
];
|
|
9273
|
+
var MATRIX_STYLES = [
|
|
9274
|
+
{ id: "matrix", label: "\u25A1" },
|
|
9275
|
+
{ id: "pmatrix", label: "(\u25A1)" },
|
|
9276
|
+
{ id: "bmatrix", label: "[\u25A1]" },
|
|
9277
|
+
{ id: "Bmatrix", label: "{\u25A1}" },
|
|
9278
|
+
{ id: "vmatrix", label: "|\u25A1|" },
|
|
9279
|
+
{ id: "Vmatrix", label: "||\u25A1||" }
|
|
9280
|
+
];
|
|
9281
|
+
var MATRIX_PRESETS = [
|
|
9282
|
+
{ rows: 2, columns: 2 },
|
|
9283
|
+
{ rows: 2, columns: 3 },
|
|
9284
|
+
{ rows: 3, columns: 2 },
|
|
9285
|
+
{ rows: 3, columns: 3 }
|
|
9286
|
+
];
|
|
9287
|
+
var ARRAY_ALIGNMENTS = ["l", "c", "r"];
|
|
9288
|
+
function clampMatrixSize(value) {
|
|
9289
|
+
return Math.max(1, Math.min(12, Math.trunc(value)));
|
|
9290
|
+
}
|
|
9291
|
+
function matrixSizeLabel(rows, columns, messages) {
|
|
9292
|
+
const rowLabel = rows === 1 ? messages.row : messages.rows;
|
|
9293
|
+
const columnLabel = columns === 1 ? messages.column : messages.columns;
|
|
9294
|
+
return `${String(rows)} ${rowLabel} \xD7 ${String(columns)} ${columnLabel}`;
|
|
9295
|
+
}
|
|
9296
|
+
function matrixStyleTitle(style, messages) {
|
|
9297
|
+
if (style === "pmatrix") return messages.matrixParentheses;
|
|
9298
|
+
if (style === "bmatrix") return messages.matrixBrackets;
|
|
9299
|
+
if (style === "Bmatrix") return messages.matrixBraces;
|
|
9300
|
+
if (style === "vmatrix") return messages.matrixBars;
|
|
9301
|
+
if (style === "Vmatrix") return messages.matrixDoubleBars;
|
|
9302
|
+
return messages.matrixNoDelimiters;
|
|
9303
|
+
}
|
|
9304
|
+
function alignmentLabel(alignment, messages) {
|
|
9305
|
+
if (alignment === "l") return messages.alignLeft;
|
|
9306
|
+
if (alignment === "r") return messages.alignRight;
|
|
9307
|
+
return messages.alignCenter;
|
|
9308
|
+
}
|
|
9309
|
+
function alignmentTitle(alignment, messages) {
|
|
9310
|
+
if (alignment === "l") return messages.alignColumnLeft;
|
|
9311
|
+
if (alignment === "r") return messages.alignColumnRight;
|
|
9312
|
+
return messages.alignColumnCenter;
|
|
9313
|
+
}
|
|
9314
|
+
function characterFontTitle(fontId, messages) {
|
|
9315
|
+
const key = characterFontSpec(fontId).titleKey;
|
|
9316
|
+
return messages[key] ?? messages.defaultFont;
|
|
9317
|
+
}
|
|
9318
|
+
function digitTitle(digitForm, messages) {
|
|
9319
|
+
if (digitForm === "arabicIndic") return messages.arabicIndicDigits;
|
|
9320
|
+
if (digitForm === "persianIndic") return messages.persianIndicDigits;
|
|
9321
|
+
return messages.westernDigits;
|
|
9322
|
+
}
|
|
9323
|
+
function spacingArrow(command, side) {
|
|
9324
|
+
const pointsWithFlow = command.spacing.direction === "positive";
|
|
9325
|
+
if (pointsWithFlow) {
|
|
9326
|
+
return side === "arabic" ? "\u2190" : "\u2192";
|
|
9327
|
+
}
|
|
9328
|
+
return side === "arabic" ? "\u2192" : "\u2190";
|
|
8573
9329
|
}
|
|
8574
|
-
function
|
|
8575
|
-
|
|
8576
|
-
|
|
8577
|
-
|
|
8578
|
-
|
|
8579
|
-
|
|
9330
|
+
function functionLabel(command) {
|
|
9331
|
+
if (command.id !== "ln") {
|
|
9332
|
+
return command.arabicLabel;
|
|
9333
|
+
}
|
|
9334
|
+
return /* @__PURE__ */ jsxs("span", { className: "function-command-label-with-sub", "aria-hidden": "true", children: [
|
|
9335
|
+
/* @__PURE__ */ jsx("span", { className: "function-command-label-with-sub__base", children: command.arabicLabel }),
|
|
9336
|
+
/* @__PURE__ */ jsx("span", { className: "function-command-label-with-sub__sub", children: "\u0647\u0640" })
|
|
9337
|
+
] });
|
|
9338
|
+
}
|
|
9339
|
+
function operatorLabel(command) {
|
|
9340
|
+
const label = command.svg_path ? /* @__PURE__ */ jsx(
|
|
9341
|
+
"span",
|
|
9342
|
+
{
|
|
9343
|
+
className: "operator-command-svg-label",
|
|
9344
|
+
"aria-hidden": "true",
|
|
9345
|
+
style: {
|
|
9346
|
+
mask: `url("${command.svg_path}") center / contain no-repeat`,
|
|
9347
|
+
WebkitMask: `url("${command.svg_path}") center / contain no-repeat`
|
|
9348
|
+
}
|
|
9349
|
+
}
|
|
9350
|
+
) : command.Label;
|
|
9351
|
+
return /* @__PURE__ */ jsx("span", { className: shouldMirrorOperatorDisplay(command) ? "operator-command-label operator-command-label--mirror" : "operator-command-label", children: label });
|
|
9352
|
+
}
|
|
9353
|
+
function categoryTitle(view, messages) {
|
|
9354
|
+
if (view === "delimiters") return messages.insertDelimiters;
|
|
9355
|
+
if (view === "structures") return messages.structures;
|
|
9356
|
+
if (view === "functions") return messages.functions;
|
|
9357
|
+
if (view === "operators") return messages.operations;
|
|
9358
|
+
if (view === "matrices") return messages.matrices;
|
|
9359
|
+
if (view === "typography") return messages.typography;
|
|
9360
|
+
if (view === "spacing") return messages.spaces;
|
|
9361
|
+
if (view === "digits") return messages.digitForms;
|
|
9362
|
+
return messages.moreActions;
|
|
9363
|
+
}
|
|
9364
|
+
function EquationMobileToolbar({
|
|
9365
|
+
uiLocale,
|
|
9366
|
+
messages,
|
|
9367
|
+
state,
|
|
9368
|
+
showSideSwitcher,
|
|
9369
|
+
inputRef,
|
|
9370
|
+
getRuntime
|
|
9371
|
+
}) {
|
|
9372
|
+
const [sheetView, setSheetView] = useState("closed");
|
|
9373
|
+
const [envMode, setEnvMode] = useState("matrix");
|
|
9374
|
+
const [matrixStyle, setMatrixStyle] = useState("pmatrix");
|
|
9375
|
+
const [matrixRows, setMatrixRows] = useState(2);
|
|
9376
|
+
const [matrixColumns, setMatrixColumns] = useState(2);
|
|
9377
|
+
const [alignmentColumn, setAlignmentColumn] = useState(1);
|
|
9378
|
+
const dialogRef = useRef2(null);
|
|
9379
|
+
const moreButtonRef = useRef2(null);
|
|
9380
|
+
const delimiterButtonRef = useRef2(null);
|
|
9381
|
+
const backButtonRef = useRef2(null);
|
|
9382
|
+
const restoreFocusRef = useRef2(null);
|
|
9383
|
+
const sheetTitleId = useId();
|
|
9384
|
+
const sheetOpen = sheetView !== "closed";
|
|
9385
|
+
function dismissSheet() {
|
|
9386
|
+
setSheetView("closed");
|
|
9387
|
+
}
|
|
9388
|
+
useDialogFocus({ open: sheetOpen, dialogRef, onClose: dismissSheet, triggerRef: restoreFocusRef });
|
|
9389
|
+
useEffect2(() => {
|
|
9390
|
+
if (sheetView !== "closed" && sheetView !== "root" && sheetView !== "delimiters") {
|
|
9391
|
+
const timer = window.setTimeout(() => backButtonRef.current?.focus(), 0);
|
|
9392
|
+
return () => window.clearTimeout(timer);
|
|
9393
|
+
}
|
|
9394
|
+
}, [sheetView]);
|
|
9395
|
+
function focusInputAfterClose() {
|
|
9396
|
+
restoreFocusRef.current = inputRef.current;
|
|
9397
|
+
setSheetView("closed");
|
|
9398
|
+
window.requestAnimationFrame(() => getRuntime()?.focusInput());
|
|
9399
|
+
}
|
|
9400
|
+
function runAndClose(action) {
|
|
9401
|
+
const runtime = getRuntime();
|
|
9402
|
+
if (runtime) {
|
|
9403
|
+
action(runtime);
|
|
9404
|
+
}
|
|
9405
|
+
focusInputAfterClose();
|
|
9406
|
+
}
|
|
9407
|
+
function runAndKeepFocus(button, action) {
|
|
9408
|
+
const runtime = getRuntime();
|
|
9409
|
+
if (runtime) {
|
|
9410
|
+
action(runtime);
|
|
9411
|
+
}
|
|
9412
|
+
window.requestAnimationFrame(() => button.focus());
|
|
9413
|
+
}
|
|
9414
|
+
function openMore() {
|
|
9415
|
+
restoreFocusRef.current = moreButtonRef.current;
|
|
9416
|
+
setSheetView("root");
|
|
9417
|
+
}
|
|
9418
|
+
function openDelimiters() {
|
|
9419
|
+
restoreFocusRef.current = delimiterButtonRef.current;
|
|
9420
|
+
setSheetView("delimiters");
|
|
9421
|
+
}
|
|
9422
|
+
function setMatrixDimension(kind, value) {
|
|
9423
|
+
const next = clampMatrixSize(value);
|
|
9424
|
+
if (kind === "rows") {
|
|
9425
|
+
setMatrixRows(next);
|
|
9426
|
+
} else {
|
|
9427
|
+
setMatrixColumns(envMode === "aligned" ? 2 : next);
|
|
8580
9428
|
}
|
|
8581
|
-
nodes.push(converted.node);
|
|
8582
9429
|
}
|
|
8583
|
-
|
|
9430
|
+
function insertEnvironment() {
|
|
9431
|
+
runAndClose((runtime) => {
|
|
9432
|
+
if (envMode === "array") {
|
|
9433
|
+
runtime.insertArrayEnv(matrixRows, matrixColumns);
|
|
9434
|
+
} else if (envMode === "aligned") {
|
|
9435
|
+
runtime.insertAlignedEnv(matrixRows, 2);
|
|
9436
|
+
} else {
|
|
9437
|
+
runtime.insertMatrixEnv(matrixStyle, matrixRows, matrixColumns);
|
|
9438
|
+
}
|
|
9439
|
+
});
|
|
9440
|
+
}
|
|
9441
|
+
const directButtonMouseDown = (event) => event.preventDefault();
|
|
9442
|
+
const undoArrow = state.activeSide === "arabic" ? "\u21B7" : "\u21B6";
|
|
9443
|
+
const redoArrow = state.activeSide === "arabic" ? "\u21B6" : "\u21B7";
|
|
9444
|
+
const renderFunctionGroup = (label, commands, limits = false, outline = false) => /* @__PURE__ */ jsxs("section", { className: "butex-widget__sheet-section", children: [
|
|
9445
|
+
/* @__PURE__ */ jsx("h4", { children: label }),
|
|
9446
|
+
/* @__PURE__ */ jsx("div", { className: "butex-widget__sheet-command-grid", children: commands.map((command) => /* @__PURE__ */ jsx(
|
|
9447
|
+
"button",
|
|
9448
|
+
{
|
|
9449
|
+
className: `function-command-option${outline ? " function-command-option--outline" : ""}`,
|
|
9450
|
+
type: "button",
|
|
9451
|
+
title: atomicCommandTitle(command, uiLocale),
|
|
9452
|
+
"aria-label": atomicCommandTitle(command, uiLocale),
|
|
9453
|
+
onClick: () => runAndClose((runtime) => {
|
|
9454
|
+
if (limits) runtime.insertLimitsSeriesTemplate(command.id);
|
|
9455
|
+
else runtime.insertAtomicCommand(command.id);
|
|
9456
|
+
}),
|
|
9457
|
+
children: functionLabel(command)
|
|
9458
|
+
},
|
|
9459
|
+
command.id
|
|
9460
|
+
)) })
|
|
9461
|
+
] }, label);
|
|
9462
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
9463
|
+
/* @__PURE__ */ jsxs("div", { className: "butex-widget__mobile-toolbar", role: "toolbar", "aria-label": messages.compactToolbar, children: [
|
|
9464
|
+
/* @__PURE__ */ jsx("button", { type: "button", disabled: !state.canUndo, title: messages.undo, "aria-label": messages.undo, onMouseDown: directButtonMouseDown, onClick: () => getRuntime()?.performUndo(), children: undoArrow }),
|
|
9465
|
+
/* @__PURE__ */ jsx("button", { type: "button", disabled: !state.canRedo, title: messages.redo, "aria-label": messages.redo, onMouseDown: directButtonMouseDown, onClick: () => getRuntime()?.performRedo(), children: redoArrow }),
|
|
9466
|
+
/* @__PURE__ */ jsx("button", { type: "button", title: messages.insertFraction, "aria-label": messages.insertFraction, onMouseDown: directButtonMouseDown, onClick: () => getRuntime()?.insertFraction(), children: /* @__PURE__ */ jsxs("span", { className: "toolbar-frac-icon", "aria-hidden": "true", children: [
|
|
9467
|
+
/* @__PURE__ */ jsx("span", { children: "\u0623" }),
|
|
9468
|
+
/* @__PURE__ */ jsx("span", { children: "\u0628" })
|
|
9469
|
+
] }) }),
|
|
9470
|
+
/* @__PURE__ */ jsx("button", { type: "button", title: messages.addSuperscript, "aria-label": messages.addSuperscript, onMouseDown: directButtonMouseDown, onClick: () => getRuntime()?.addSup(), children: /* @__PURE__ */ jsxs("span", { className: "toolbar-script-icon toolbar-script-icon--sup", "aria-hidden": "true", children: [
|
|
9471
|
+
/* @__PURE__ */ jsx("span", { children: "\u0646" }),
|
|
9472
|
+
/* @__PURE__ */ jsx("span", { children: "\u0633" })
|
|
9473
|
+
] }) }),
|
|
9474
|
+
/* @__PURE__ */ jsx("button", { type: "button", title: messages.addSubscript, "aria-label": messages.addSubscript, onMouseDown: directButtonMouseDown, onClick: () => getRuntime()?.addSub(), children: /* @__PURE__ */ jsxs("span", { className: "toolbar-script-icon toolbar-script-icon--sub", "aria-hidden": "true", children: [
|
|
9475
|
+
/* @__PURE__ */ jsx("span", { children: "\u0646" }),
|
|
9476
|
+
/* @__PURE__ */ jsx("span", { children: "\u0633" })
|
|
9477
|
+
] }) }),
|
|
9478
|
+
/* @__PURE__ */ jsx("button", { ref: delimiterButtonRef, type: "button", title: messages.insertDelimiters, "aria-label": messages.insertDelimiters, "aria-haspopup": "dialog", "aria-expanded": sheetView === "delimiters", onClick: openDelimiters, children: "()" }),
|
|
9479
|
+
/* @__PURE__ */ jsx("button", { className: "butex-widget__mobile-danger", type: "button", title: messages.deleteSelectedStructure, "aria-label": messages.deleteSelectedStructure, onMouseDown: directButtonMouseDown, onClick: () => getRuntime()?.deleteStructure(), children: "\xD7" }),
|
|
9480
|
+
/* @__PURE__ */ jsx("button", { ref: moreButtonRef, type: "button", title: messages.moreActions, "aria-label": messages.moreActions, "aria-haspopup": "dialog", "aria-expanded": sheetOpen && sheetView !== "delimiters", onClick: openMore, children: "\u22EF" })
|
|
9481
|
+
] }),
|
|
9482
|
+
sheetOpen ? /* @__PURE__ */ jsx(
|
|
9483
|
+
"div",
|
|
9484
|
+
{
|
|
9485
|
+
className: "butex-widget__command-sheet-backdrop",
|
|
9486
|
+
role: "presentation",
|
|
9487
|
+
onClick: (event) => {
|
|
9488
|
+
if (event.target === event.currentTarget) dismissSheet();
|
|
9489
|
+
},
|
|
9490
|
+
children: /* @__PURE__ */ jsxs(
|
|
9491
|
+
"div",
|
|
9492
|
+
{
|
|
9493
|
+
ref: dialogRef,
|
|
9494
|
+
className: "butex-widget__command-sheet",
|
|
9495
|
+
role: "dialog",
|
|
9496
|
+
"aria-modal": "true",
|
|
9497
|
+
"aria-labelledby": sheetTitleId,
|
|
9498
|
+
tabIndex: -1,
|
|
9499
|
+
children: [
|
|
9500
|
+
/* @__PURE__ */ jsxs("div", { className: "butex-widget__command-sheet-header", children: [
|
|
9501
|
+
sheetView !== "root" && sheetView !== "delimiters" ? /* @__PURE__ */ jsx("button", { ref: backButtonRef, type: "button", onClick: () => setSheetView("root"), children: messages.back }) : /* @__PURE__ */ jsx("span", {}),
|
|
9502
|
+
/* @__PURE__ */ jsx("strong", { id: sheetTitleId, children: categoryTitle(sheetView, messages) }),
|
|
9503
|
+
/* @__PURE__ */ jsx("button", { type: "button", "data-dialog-initial-focus": true, "aria-label": messages.closeActions, onClick: dismissSheet, children: "\xD7" })
|
|
9504
|
+
] }),
|
|
9505
|
+
/* @__PURE__ */ jsxs("div", { className: "butex-widget__command-sheet-body", children: [
|
|
9506
|
+
sheetView === "root" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
9507
|
+
showSideSwitcher ? /* @__PURE__ */ jsxs("section", { className: "butex-widget__sheet-section", children: [
|
|
9508
|
+
/* @__PURE__ */ jsx("h4", { children: messages.activeSide }),
|
|
9509
|
+
/* @__PURE__ */ jsxs("div", { className: "butex-widget__sheet-choice-row", children: [
|
|
9510
|
+
/* @__PURE__ */ jsx(
|
|
9511
|
+
"button",
|
|
9512
|
+
{
|
|
9513
|
+
type: "button",
|
|
9514
|
+
"aria-pressed": state.activeSide === "arabic",
|
|
9515
|
+
onClick: (event) => {
|
|
9516
|
+
if (state.activeSide !== "arabic") runAndKeepFocus(event.currentTarget, (runtime) => runtime.toggleSide());
|
|
9517
|
+
},
|
|
9518
|
+
children: messages.arabicSide
|
|
9519
|
+
}
|
|
9520
|
+
),
|
|
9521
|
+
/* @__PURE__ */ jsx(
|
|
9522
|
+
"button",
|
|
9523
|
+
{
|
|
9524
|
+
type: "button",
|
|
9525
|
+
"aria-pressed": state.activeSide === "english",
|
|
9526
|
+
onClick: (event) => {
|
|
9527
|
+
if (state.activeSide !== "english") runAndKeepFocus(event.currentTarget, (runtime) => runtime.toggleSide());
|
|
9528
|
+
},
|
|
9529
|
+
children: messages.englishSide
|
|
9530
|
+
}
|
|
9531
|
+
)
|
|
9532
|
+
] })
|
|
9533
|
+
] }) : null,
|
|
9534
|
+
/* @__PURE__ */ jsxs("section", { className: "butex-widget__sheet-section", children: [
|
|
9535
|
+
/* @__PURE__ */ jsx("h4", { children: messages.clipboard }),
|
|
9536
|
+
/* @__PURE__ */ jsxs("div", { className: "butex-widget__sheet-choice-row", children: [
|
|
9537
|
+
/* @__PURE__ */ jsx("button", { type: "button", disabled: !state.hasSelection, onClick: () => runAndClose((runtime) => {
|
|
9538
|
+
void runtime.performCopy();
|
|
9539
|
+
}), children: messages.copy }),
|
|
9540
|
+
/* @__PURE__ */ jsx("button", { type: "button", disabled: !state.hasSelection, onClick: () => runAndClose((runtime) => {
|
|
9541
|
+
void runtime.performCut();
|
|
9542
|
+
}), children: messages.cut }),
|
|
9543
|
+
/* @__PURE__ */ jsx("button", { type: "button", onClick: () => runAndClose((runtime) => {
|
|
9544
|
+
void runtime.performPaste();
|
|
9545
|
+
}), children: messages.paste })
|
|
9546
|
+
] })
|
|
9547
|
+
] }),
|
|
9548
|
+
/* @__PURE__ */ jsx("nav", { className: "butex-widget__sheet-categories", "aria-label": messages.commandCategories, children: ["structures", "functions", "operators", "matrices", "typography", "spacing", "digits"].map((view) => /* @__PURE__ */ jsx("button", { type: "button", onClick: () => setSheetView(view), children: categoryTitle(view, messages) }, view)) })
|
|
9549
|
+
] }) : null,
|
|
9550
|
+
sheetView === "delimiters" ? /* @__PURE__ */ jsx("div", { className: "butex-widget__sheet-command-grid butex-widget__sheet-command-grid--three", children: [
|
|
9551
|
+
{ kind: "paren", label: "()", title: messages.insertParentheses },
|
|
9552
|
+
{ kind: "bracket", label: "[]", title: messages.insertBrackets },
|
|
9553
|
+
{ kind: "brace", label: "{}", title: messages.insertBraces }
|
|
9554
|
+
].map((option) => /* @__PURE__ */ jsx("button", { type: "button", "aria-label": option.title, title: option.title, onClick: () => runAndClose((runtime) => runtime.insertDelimiterByKind(option.kind)), children: option.label }, option.kind)) }) : null,
|
|
9555
|
+
sheetView === "structures" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
9556
|
+
/* @__PURE__ */ jsxs("div", { className: "butex-widget__sheet-command-grid", children: [
|
|
9557
|
+
/* @__PURE__ */ jsx("button", { type: "button", title: messages.insertRoot, "aria-label": messages.insertRoot, onClick: () => runAndClose((runtime) => runtime.insertSqrt()), children: /* @__PURE__ */ jsx("span", { className: "toolbar-sqrt-icon", "aria-hidden": "true", children: "\u221A" }) }),
|
|
9558
|
+
/* @__PURE__ */ jsx("button", { type: "button", title: messages.insertOverset, "aria-label": messages.insertOverset, onClick: () => runAndClose((runtime) => runtime.insertOverset()), children: /* @__PURE__ */ jsxs("span", { className: "toolbar-accent-icon toolbar-accent-icon--over", "aria-hidden": "true", children: [
|
|
9559
|
+
/* @__PURE__ */ jsx("span", { children: "\u2217" }),
|
|
9560
|
+
/* @__PURE__ */ jsx("span", { children: "\u25A1" })
|
|
9561
|
+
] }) }),
|
|
9562
|
+
/* @__PURE__ */ jsx("button", { type: "button", title: messages.insertUnderset, "aria-label": messages.insertUnderset, onClick: () => runAndClose((runtime) => runtime.insertUnderset()), children: /* @__PURE__ */ jsxs("span", { className: "toolbar-accent-icon toolbar-accent-icon--under", "aria-hidden": "true", children: [
|
|
9563
|
+
/* @__PURE__ */ jsx("span", { children: "\u25A1" }),
|
|
9564
|
+
/* @__PURE__ */ jsx("span", { children: "\u2217" })
|
|
9565
|
+
] }) }),
|
|
9566
|
+
/* @__PURE__ */ jsx("button", { type: "button", title: messages.insertAccentPair, "aria-label": messages.insertAccentPair, onClick: () => runAndClose((runtime) => runtime.insertAccentPair()), children: /* @__PURE__ */ jsxs("span", { className: "toolbar-accent-icon toolbar-accent-icon--pair", "aria-hidden": "true", children: [
|
|
9567
|
+
/* @__PURE__ */ jsx("span", { children: "\u2217" }),
|
|
9568
|
+
/* @__PURE__ */ jsx("span", { children: "\u25A1" }),
|
|
9569
|
+
/* @__PURE__ */ jsx("span", { children: "\u2217" })
|
|
9570
|
+
] }) }),
|
|
9571
|
+
/* @__PURE__ */ jsx("button", { type: "button", title: messages.removeSuperscript, "aria-label": messages.removeSuperscript, onClick: () => runAndClose((runtime) => runtime.removeSup()), children: /* @__PURE__ */ jsxs("span", { className: "toolbar-remove-script-icon toolbar-remove-script-icon--sup", "aria-hidden": "true", children: [
|
|
9572
|
+
/* @__PURE__ */ jsx("span", { children: "\xD7" }),
|
|
9573
|
+
/* @__PURE__ */ jsx("span", { children: "\u0646" })
|
|
9574
|
+
] }) }),
|
|
9575
|
+
/* @__PURE__ */ jsx("button", { type: "button", title: messages.removeSubscript, "aria-label": messages.removeSubscript, onClick: () => runAndClose((runtime) => runtime.removeSub()), children: /* @__PURE__ */ jsxs("span", { className: "toolbar-remove-script-icon toolbar-remove-script-icon--sub", "aria-hidden": "true", children: [
|
|
9576
|
+
/* @__PURE__ */ jsx("span", { children: "\xD7" }),
|
|
9577
|
+
/* @__PURE__ */ jsx("span", { children: "\u0646" })
|
|
9578
|
+
] }) })
|
|
9579
|
+
] }),
|
|
9580
|
+
/* @__PURE__ */ jsxs("section", { className: "butex-widget__sheet-section", children: [
|
|
9581
|
+
/* @__PURE__ */ jsx("h4", { children: messages.insertAccents }),
|
|
9582
|
+
/* @__PURE__ */ jsx("div", { className: "butex-widget__sheet-command-grid", children: ACCENT_COMMANDS2.map((command) => /* @__PURE__ */ jsx("button", { className: "operator-command-option", type: "button", title: accentCommandTitle(command, uiLocale), "aria-label": accentCommandTitle(command, uiLocale), onClick: () => runAndClose((runtime) => runtime.insertAccent(command.id)), children: /* @__PURE__ */ jsx("span", { className: "operator-command-label", "aria-hidden": "true", children: command.label }) }, command.id)) })
|
|
9583
|
+
] })
|
|
9584
|
+
] }) : null,
|
|
9585
|
+
sheetView === "functions" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
9586
|
+
renderFunctionGroup(messages.insertFunction, FUNCTION_COMMANDS),
|
|
9587
|
+
renderFunctionGroup(messages.insertLimitsSeries, LIMITS_SERIES_COMMANDS, true),
|
|
9588
|
+
renderFunctionGroup(messages.insertAdditionalFunctions, FUNCTION2_COMMANDS),
|
|
9589
|
+
renderFunctionGroup(messages.insertDerivative, DERIVATIVE_COMMANDS),
|
|
9590
|
+
/* @__PURE__ */ jsxs("div", { className: "butex-widget__sheet-command-grid", children: [
|
|
9591
|
+
/* @__PURE__ */ jsx("button", { className: "function-command-option", type: "button", title: messages.insertFirstDerivative, "aria-label": messages.insertFirstDerivative, onClick: () => runAndClose((runtime) => runtime.insertFirstDerivative()), children: "\u0621/\u0633" }),
|
|
9592
|
+
/* @__PURE__ */ jsx("button", { className: "function-command-option", type: "button", title: messages.insertSecondDerivative, "aria-label": messages.insertSecondDerivative, onClick: () => runAndClose((runtime) => runtime.insertSecondDerivative()), children: "\u0621\xB2/\u0633\xB2" })
|
|
9593
|
+
] }),
|
|
9594
|
+
renderFunctionGroup(messages.insertNumberSets, GROUP_COMMANDS, false, true)
|
|
9595
|
+
] }) : null,
|
|
9596
|
+
sheetView === "operators" ? OPERATOR_GROUPS.map((commands, index) => /* @__PURE__ */ jsx("section", { className: "butex-widget__sheet-section", children: /* @__PURE__ */ jsx("div", { className: "butex-widget__sheet-command-grid", children: commands.map((command) => /* @__PURE__ */ jsx("button", { className: "operator-command-option", type: "button", title: atomicOperatorCommandTitle(command, uiLocale), "aria-label": atomicOperatorCommandTitle(command, uiLocale), onClick: () => runAndClose((runtime) => runtime.insertAtomicOperatorCommand(command.id)), children: operatorLabel(command) }, command.id)) }) }, String(index))) : null,
|
|
9597
|
+
sheetView === "matrices" ? /* @__PURE__ */ jsxs("div", { className: "butex-widget__mobile-matrix-picker", children: [
|
|
9598
|
+
/* @__PURE__ */ jsx("div", { className: "butex-widget__sheet-choice-row", role: "group", "aria-label": messages.environmentType, children: [
|
|
9599
|
+
{ id: "matrix", label: messages.matrix },
|
|
9600
|
+
{ id: "array", label: messages.array },
|
|
9601
|
+
{ id: "aligned", label: messages.aligned }
|
|
9602
|
+
].map((option) => /* @__PURE__ */ jsx(
|
|
9603
|
+
"button",
|
|
9604
|
+
{
|
|
9605
|
+
type: "button",
|
|
9606
|
+
"aria-pressed": envMode === option.id,
|
|
9607
|
+
onClick: () => {
|
|
9608
|
+
setEnvMode(option.id);
|
|
9609
|
+
if (option.id === "aligned") setMatrixColumns(2);
|
|
9610
|
+
},
|
|
9611
|
+
children: option.label
|
|
9612
|
+
},
|
|
9613
|
+
option.id
|
|
9614
|
+
)) }),
|
|
9615
|
+
envMode === "matrix" ? /* @__PURE__ */ jsx("div", { className: "butex-widget__sheet-choice-row", role: "group", "aria-label": messages.matrixType, children: MATRIX_STYLES.map((style) => /* @__PURE__ */ jsx("button", { type: "button", title: matrixStyleTitle(style.id, messages), "aria-label": matrixStyleTitle(style.id, messages), "aria-pressed": matrixStyle === style.id, onClick: () => setMatrixStyle(style.id), children: style.label }, style.id)) }) : null,
|
|
9616
|
+
/* @__PURE__ */ jsxs("section", { className: "butex-widget__sheet-section", children: [
|
|
9617
|
+
/* @__PURE__ */ jsx("h4", { children: messages.commonMatrixSizes }),
|
|
9618
|
+
/* @__PURE__ */ jsx("div", { className: "butex-widget__matrix-presets", children: (envMode === "aligned" ? MATRIX_PRESETS.filter((preset) => preset.columns === 2) : MATRIX_PRESETS).map((preset) => /* @__PURE__ */ jsxs(
|
|
9619
|
+
"button",
|
|
9620
|
+
{
|
|
9621
|
+
type: "button",
|
|
9622
|
+
"aria-pressed": matrixRows === preset.rows && matrixColumns === preset.columns,
|
|
9623
|
+
onClick: () => {
|
|
9624
|
+
setMatrixRows(preset.rows);
|
|
9625
|
+
setMatrixColumns(envMode === "aligned" ? 2 : preset.columns);
|
|
9626
|
+
},
|
|
9627
|
+
children: [
|
|
9628
|
+
preset.rows,
|
|
9629
|
+
"\xD7",
|
|
9630
|
+
envMode === "aligned" ? 2 : preset.columns
|
|
9631
|
+
]
|
|
9632
|
+
},
|
|
9633
|
+
`${String(preset.rows)}-${String(preset.columns)}`
|
|
9634
|
+
)) })
|
|
9635
|
+
] }),
|
|
9636
|
+
/* @__PURE__ */ jsxs("div", { className: "butex-widget__matrix-stepper-row", children: [
|
|
9637
|
+
/* @__PURE__ */ jsx("span", { children: messages.rows }),
|
|
9638
|
+
/* @__PURE__ */ jsxs("div", { className: "butex-widget__matrix-stepper", children: [
|
|
9639
|
+
/* @__PURE__ */ jsx("button", { type: "button", disabled: matrixRows <= 1, "aria-label": messages.decreaseRows, onClick: () => setMatrixDimension("rows", matrixRows - 1), children: "\u2212" }),
|
|
9640
|
+
/* @__PURE__ */ jsx("output", { "aria-live": "polite", children: matrixRows }),
|
|
9641
|
+
/* @__PURE__ */ jsx("button", { type: "button", disabled: matrixRows >= 12, "aria-label": messages.increaseRows, onClick: () => setMatrixDimension("rows", matrixRows + 1), children: "+" })
|
|
9642
|
+
] })
|
|
9643
|
+
] }),
|
|
9644
|
+
/* @__PURE__ */ jsxs("div", { className: "butex-widget__matrix-stepper-row", children: [
|
|
9645
|
+
/* @__PURE__ */ jsx("span", { children: messages.columns }),
|
|
9646
|
+
/* @__PURE__ */ jsxs("div", { className: "butex-widget__matrix-stepper", children: [
|
|
9647
|
+
/* @__PURE__ */ jsx("button", { type: "button", disabled: matrixColumns <= 1 || envMode === "aligned", "aria-label": messages.decreaseColumns, onClick: () => setMatrixDimension("columns", matrixColumns - 1), children: "\u2212" }),
|
|
9648
|
+
/* @__PURE__ */ jsx("output", { "aria-live": "polite", children: envMode === "aligned" ? 2 : matrixColumns }),
|
|
9649
|
+
/* @__PURE__ */ jsx("button", { type: "button", disabled: matrixColumns >= 12 || envMode === "aligned", "aria-label": messages.increaseColumns, onClick: () => setMatrixDimension("columns", matrixColumns + 1), children: "+" })
|
|
9650
|
+
] })
|
|
9651
|
+
] }),
|
|
9652
|
+
/* @__PURE__ */ jsx("p", { className: "butex-widget__matrix-size-summary", "aria-live": "polite", children: matrixSizeLabel(matrixRows, envMode === "aligned" ? 2 : matrixColumns, messages) }),
|
|
9653
|
+
/* @__PURE__ */ jsx("button", { type: "button", className: "butex-widget__matrix-insert", onClick: insertEnvironment, children: messages.insert }),
|
|
9654
|
+
/* @__PURE__ */ jsxs("section", { className: "butex-widget__sheet-section", children: [
|
|
9655
|
+
/* @__PURE__ */ jsx("h4", { children: messages.editSelectedEnvironment }),
|
|
9656
|
+
envMode === "matrix" ? /* @__PURE__ */ jsx("button", { type: "button", onClick: () => getRuntime()?.setMatrixEnvStyle(matrixStyle), children: messages.applyStyle }) : null,
|
|
9657
|
+
envMode === "array" ? /* @__PURE__ */ jsxs("div", { className: "butex-widget__matrix-alignment", children: [
|
|
9658
|
+
/* @__PURE__ */ jsxs("label", { children: [
|
|
9659
|
+
messages.column,
|
|
9660
|
+
/* @__PURE__ */ jsx("input", { type: "number", min: 1, max: 12, value: alignmentColumn, onChange: (event) => setAlignmentColumn(clampMatrixSize(Number(event.currentTarget.value) || 1)) })
|
|
9661
|
+
] }),
|
|
9662
|
+
ARRAY_ALIGNMENTS.map((alignment) => /* @__PURE__ */ jsx("button", { type: "button", title: alignmentTitle(alignment, messages), onClick: () => getRuntime()?.setArrayColumnAlignment(alignmentColumn - 1, alignment), children: alignmentLabel(alignment, messages) }, alignment))
|
|
9663
|
+
] }) : null,
|
|
9664
|
+
/* @__PURE__ */ jsxs("div", { className: "butex-widget__sheet-command-grid", children: [
|
|
9665
|
+
/* @__PURE__ */ jsxs("button", { type: "button", onClick: () => getRuntime()?.addMatrixRow(), children: [
|
|
9666
|
+
"+",
|
|
9667
|
+
messages.row
|
|
9668
|
+
] }),
|
|
9669
|
+
/* @__PURE__ */ jsxs("button", { type: "button", onClick: () => getRuntime()?.removeMatrixRow(), children: [
|
|
9670
|
+
"\u2212",
|
|
9671
|
+
messages.row
|
|
9672
|
+
] }),
|
|
9673
|
+
/* @__PURE__ */ jsxs("button", { type: "button", onClick: () => getRuntime()?.addMatrixColumn(), children: [
|
|
9674
|
+
"+",
|
|
9675
|
+
messages.column
|
|
9676
|
+
] }),
|
|
9677
|
+
/* @__PURE__ */ jsxs("button", { type: "button", onClick: () => getRuntime()?.removeMatrixColumn(), children: [
|
|
9678
|
+
"\u2212",
|
|
9679
|
+
messages.column
|
|
9680
|
+
] })
|
|
9681
|
+
] })
|
|
9682
|
+
] })
|
|
9683
|
+
] }) : null,
|
|
9684
|
+
sheetView === "typography" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
9685
|
+
/* @__PURE__ */ jsxs("section", { className: "butex-widget__sheet-section", children: [
|
|
9686
|
+
/* @__PURE__ */ jsx("h4", { children: messages.chooseWritingFont }),
|
|
9687
|
+
/* @__PURE__ */ jsx("div", { className: "butex-widget__sheet-choice-row", children: CHARACTER_FONT_OPTIONS.map((option) => /* @__PURE__ */ jsx(
|
|
9688
|
+
"button",
|
|
9689
|
+
{
|
|
9690
|
+
type: "button",
|
|
9691
|
+
className: `character-font-option--${option.id}`,
|
|
9692
|
+
"aria-pressed": state.characterFont === option.id,
|
|
9693
|
+
title: characterFontTitle(option.id, messages),
|
|
9694
|
+
onClick: (event) => runAndKeepFocus(event.currentTarget, (runtime) => runtime.setCurrentCharacterFont(option.id)),
|
|
9695
|
+
children: option.label
|
|
9696
|
+
},
|
|
9697
|
+
option.id
|
|
9698
|
+
)) })
|
|
9699
|
+
] }),
|
|
9700
|
+
/* @__PURE__ */ jsx(
|
|
9701
|
+
"button",
|
|
9702
|
+
{
|
|
9703
|
+
className: "ligature-btn butex-widget__compact-ligature",
|
|
9704
|
+
type: "button",
|
|
9705
|
+
title: !state.splitLeafTyping ? messages.disableLetterMerging : messages.enableLetterMerging,
|
|
9706
|
+
"aria-label": !state.splitLeafTyping ? messages.disableLetterMerging : messages.enableLetterMerging,
|
|
9707
|
+
"aria-pressed": !state.splitLeafTyping,
|
|
9708
|
+
onClick: (event) => runAndKeepFocus(event.currentTarget, (runtime) => runtime.toggleSplitLeafTyping()),
|
|
9709
|
+
children: !state.splitLeafTyping ? "\u0633\u0635\u0639" : "\u0633 \u0635 \u0639"
|
|
9710
|
+
}
|
|
9711
|
+
)
|
|
9712
|
+
] }) : null,
|
|
9713
|
+
sheetView === "spacing" ? /* @__PURE__ */ jsx("div", { className: "butex-widget__sheet-command-list", children: SPACING_COMMANDS.map((command) => /* @__PURE__ */ jsx("button", { type: "button", title: atomicCommandTitle(command, uiLocale), "aria-label": atomicCommandTitle(command, uiLocale), onClick: () => runAndClose((runtime) => runtime.insertAtomicCommand(command.id)), children: /* @__PURE__ */ jsxs(
|
|
9714
|
+
"span",
|
|
9715
|
+
{
|
|
9716
|
+
className: `spacing-command-glyph spacing-command-glyph--${command.spacing.direction} spacing-command-glyph--level-${String(command.spacing.level)}`,
|
|
9717
|
+
"aria-hidden": "true",
|
|
9718
|
+
children: [
|
|
9719
|
+
command.spacing.direction === "negative" ? /* @__PURE__ */ jsx("span", { className: "spacing-command-glyph__arrow", children: spacingArrow(command, state.activeSide) }) : null,
|
|
9720
|
+
/* @__PURE__ */ jsx("span", { className: "spacing-command-glyph__bar" }),
|
|
9721
|
+
command.spacing.direction === "positive" ? /* @__PURE__ */ jsx("span", { className: "spacing-command-glyph__arrow", children: spacingArrow(command, state.activeSide) }) : null
|
|
9722
|
+
]
|
|
9723
|
+
}
|
|
9724
|
+
) }, command.id)) }) : null,
|
|
9725
|
+
sheetView === "digits" ? /* @__PURE__ */ jsx("div", { className: "butex-widget__sheet-choice-row", children: [
|
|
9726
|
+
{ id: "western", label: "456" },
|
|
9727
|
+
{ id: "arabicIndic", label: "\u0664\u0665\u0666" },
|
|
9728
|
+
{ id: "persianIndic", label: "\u06F4\u06F5\u06F6" }
|
|
9729
|
+
].map((option) => /* @__PURE__ */ jsx(
|
|
9730
|
+
"button",
|
|
9731
|
+
{
|
|
9732
|
+
type: "button",
|
|
9733
|
+
"aria-pressed": state.digitForm === option.id,
|
|
9734
|
+
title: digitTitle(option.id, messages),
|
|
9735
|
+
onClick: (event) => runAndKeepFocus(event.currentTarget, (runtime) => runtime.setCurrentDigitForm(option.id)),
|
|
9736
|
+
children: option.label
|
|
9737
|
+
},
|
|
9738
|
+
option.id
|
|
9739
|
+
)) }) : null
|
|
9740
|
+
] })
|
|
9741
|
+
]
|
|
9742
|
+
}
|
|
9743
|
+
)
|
|
9744
|
+
}
|
|
9745
|
+
) : null
|
|
9746
|
+
] });
|
|
8584
9747
|
}
|
|
8585
|
-
|
|
8586
|
-
|
|
8587
|
-
|
|
8588
|
-
|
|
9748
|
+
|
|
9749
|
+
// src/react/visibleViewport.ts
|
|
9750
|
+
function positiveFinite(value, fallback) {
|
|
9751
|
+
return Number.isFinite(value) && value > 0 ? value : fallback;
|
|
9752
|
+
}
|
|
9753
|
+
function finiteOffset(value) {
|
|
9754
|
+
return Number.isFinite(value) ? value : 0;
|
|
9755
|
+
}
|
|
9756
|
+
function visibleViewportSnapshot(view) {
|
|
9757
|
+
const fallbackWidth = positiveFinite(view.innerWidth, 1);
|
|
9758
|
+
const fallbackHeight = positiveFinite(view.innerHeight, 1);
|
|
9759
|
+
const visualViewport = view.visualViewport;
|
|
9760
|
+
if (visualViewport && Number.isFinite(visualViewport.width) && visualViewport.width > 0 && Number.isFinite(visualViewport.height) && visualViewport.height > 0) {
|
|
9761
|
+
return {
|
|
9762
|
+
width: visualViewport.width,
|
|
9763
|
+
height: visualViewport.height,
|
|
9764
|
+
offsetLeft: finiteOffset(visualViewport.offsetLeft),
|
|
9765
|
+
offsetTop: finiteOffset(visualViewport.offsetTop),
|
|
9766
|
+
scale: positiveFinite(visualViewport.scale, 1),
|
|
9767
|
+
source: "visual-viewport"
|
|
9768
|
+
};
|
|
8589
9769
|
}
|
|
8590
9770
|
return {
|
|
8591
|
-
|
|
8592
|
-
|
|
8593
|
-
|
|
8594
|
-
|
|
8595
|
-
|
|
8596
|
-
|
|
9771
|
+
width: fallbackWidth,
|
|
9772
|
+
height: fallbackHeight,
|
|
9773
|
+
offsetLeft: 0,
|
|
9774
|
+
offsetTop: 0,
|
|
9775
|
+
scale: 1,
|
|
9776
|
+
source: "layout-viewport"
|
|
9777
|
+
};
|
|
9778
|
+
}
|
|
9779
|
+
function reasonPriority(reason) {
|
|
9780
|
+
if (reason === "orientation") return 3;
|
|
9781
|
+
if (reason === "resize") return 2;
|
|
9782
|
+
if (reason === "scroll") return 1;
|
|
9783
|
+
return 0;
|
|
9784
|
+
}
|
|
9785
|
+
function observeVisibleViewport(view, onChange) {
|
|
9786
|
+
let previous = visibleViewportSnapshot(view);
|
|
9787
|
+
let frame = null;
|
|
9788
|
+
let pendingReason = "scroll";
|
|
9789
|
+
onChange({
|
|
9790
|
+
snapshot: previous,
|
|
9791
|
+
initial: true,
|
|
9792
|
+
sizeChanged: false,
|
|
9793
|
+
offsetChanged: false,
|
|
9794
|
+
reason: "initial"
|
|
9795
|
+
});
|
|
9796
|
+
const emit = () => {
|
|
9797
|
+
frame = null;
|
|
9798
|
+
const next = visibleViewportSnapshot(view);
|
|
9799
|
+
const sizeChanged = next.width !== previous.width || next.height !== previous.height || next.scale !== previous.scale || next.source !== previous.source;
|
|
9800
|
+
const offsetChanged = next.offsetLeft !== previous.offsetLeft || next.offsetTop !== previous.offsetTop;
|
|
9801
|
+
const reason = pendingReason;
|
|
9802
|
+
pendingReason = "scroll";
|
|
9803
|
+
previous = next;
|
|
9804
|
+
onChange({ snapshot: next, initial: false, sizeChanged, offsetChanged, reason });
|
|
9805
|
+
};
|
|
9806
|
+
const schedule = (reason) => {
|
|
9807
|
+
if (reasonPriority(reason) > reasonPriority(pendingReason)) {
|
|
9808
|
+
pendingReason = reason;
|
|
9809
|
+
}
|
|
9810
|
+
if (frame !== null) {
|
|
9811
|
+
return;
|
|
9812
|
+
}
|
|
9813
|
+
frame = view.requestAnimationFrame(emit);
|
|
9814
|
+
};
|
|
9815
|
+
const onResize = () => schedule("resize");
|
|
9816
|
+
const onScroll = () => schedule("scroll");
|
|
9817
|
+
const onOrientation = () => schedule("orientation");
|
|
9818
|
+
const visualViewport = view.visualViewport;
|
|
9819
|
+
visualViewport?.addEventListener("resize", onResize);
|
|
9820
|
+
visualViewport?.addEventListener("scroll", onScroll);
|
|
9821
|
+
view.addEventListener("resize", onResize);
|
|
9822
|
+
view.addEventListener("orientationchange", onOrientation);
|
|
9823
|
+
return () => {
|
|
9824
|
+
visualViewport?.removeEventListener("resize", onResize);
|
|
9825
|
+
visualViewport?.removeEventListener("scroll", onScroll);
|
|
9826
|
+
view.removeEventListener("resize", onResize);
|
|
9827
|
+
view.removeEventListener("orientationchange", onOrientation);
|
|
9828
|
+
if (frame !== null) {
|
|
9829
|
+
view.cancelAnimationFrame(frame);
|
|
9830
|
+
frame = null;
|
|
8597
9831
|
}
|
|
8598
9832
|
};
|
|
8599
9833
|
}
|
|
8600
9834
|
|
|
8601
|
-
// src/
|
|
8602
|
-
|
|
8603
|
-
|
|
8604
|
-
|
|
8605
|
-
|
|
8606
|
-
|
|
8607
|
-
|
|
8608
|
-
|
|
9835
|
+
// src/react/desktopPopover.ts
|
|
9836
|
+
import { useEffect as useEffect3 } from "react";
|
|
9837
|
+
var POPOVER_GAP = 5;
|
|
9838
|
+
var VIEWPORT_MARGIN = 8;
|
|
9839
|
+
var MIN_USABLE_HEIGHT = 96;
|
|
9840
|
+
function clearPlacement(popover) {
|
|
9841
|
+
for (const property of ["position", "inset", "left", "top", "right", "bottom", "max-width", "max-height"]) {
|
|
9842
|
+
popover.style.removeProperty(property);
|
|
9843
|
+
}
|
|
9844
|
+
delete popover.dataset.placement;
|
|
8609
9845
|
}
|
|
8610
|
-
function
|
|
8611
|
-
|
|
8612
|
-
|
|
8613
|
-
|
|
8614
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
8615
|
-
const positionMatch = message.match(/position\s+(\d+)/i);
|
|
8616
|
-
if (positionMatch) {
|
|
8617
|
-
const position = Number(positionMatch[1]);
|
|
8618
|
-
if (Number.isFinite(position)) {
|
|
8619
|
-
const location = lineColumnForPosition(text, position);
|
|
8620
|
-
return { ok: false, error: `Invalid JSON at line ${String(location.line)}, column ${String(location.column)}: ${message}` };
|
|
8621
|
-
}
|
|
9846
|
+
function useDesktopPopoverPlacement(rootRef, active, onClose) {
|
|
9847
|
+
useEffect3(() => {
|
|
9848
|
+
if (!active || typeof window === "undefined") {
|
|
9849
|
+
return;
|
|
8622
9850
|
}
|
|
8623
|
-
|
|
8624
|
-
|
|
9851
|
+
const root = rootRef.current;
|
|
9852
|
+
const trigger = root?.querySelector('.butex-widget__desktop-toolbar button[aria-expanded="true"]');
|
|
9853
|
+
const popover = trigger?.parentElement?.querySelector(
|
|
9854
|
+
':scope > [role="menu"], :scope > [role="listbox"], :scope > [role="dialog"]'
|
|
9855
|
+
);
|
|
9856
|
+
if (!root || !trigger || !popover) {
|
|
9857
|
+
return;
|
|
9858
|
+
}
|
|
9859
|
+
let frame = null;
|
|
9860
|
+
const place = () => {
|
|
9861
|
+
frame = null;
|
|
9862
|
+
clearPlacement(popover);
|
|
9863
|
+
popover.style.position = "fixed";
|
|
9864
|
+
popover.style.inset = "auto";
|
|
9865
|
+
const rootRect = root.getBoundingClientRect();
|
|
9866
|
+
const scrollBoundary = root.closest(".butex-document2-widget__equation-modal-body");
|
|
9867
|
+
const scrollBoundaryRect = scrollBoundary?.getBoundingClientRect();
|
|
9868
|
+
const triggerRect = trigger.getBoundingClientRect();
|
|
9869
|
+
const boundaryLeft = Math.max(VIEWPORT_MARGIN, rootRect.left + VIEWPORT_MARGIN);
|
|
9870
|
+
const boundaryRight = Math.max(
|
|
9871
|
+
boundaryLeft + 1,
|
|
9872
|
+
Math.min(window.innerWidth - VIEWPORT_MARGIN, rootRect.right - VIEWPORT_MARGIN)
|
|
9873
|
+
);
|
|
9874
|
+
const boundaryTop = Math.max(VIEWPORT_MARGIN, (scrollBoundaryRect?.top ?? rootRect.top) + VIEWPORT_MARGIN);
|
|
9875
|
+
const boundaryBottom = Math.max(
|
|
9876
|
+
boundaryTop + 1,
|
|
9877
|
+
Math.min(window.innerHeight - VIEWPORT_MARGIN, (scrollBoundaryRect?.bottom ?? rootRect.bottom) - VIEWPORT_MARGIN)
|
|
9878
|
+
);
|
|
9879
|
+
const availableWidth = Math.max(1, boundaryRight - boundaryLeft);
|
|
9880
|
+
popover.style.maxWidth = `${availableWidth}px`;
|
|
9881
|
+
const naturalRect = popover.getBoundingClientRect();
|
|
9882
|
+
const popoverWidth = Math.min(Math.max(naturalRect.width, popover.scrollWidth), availableWidth);
|
|
9883
|
+
const preferredLeft = root.dir === "rtl" ? triggerRect.right - popoverWidth : triggerRect.left;
|
|
9884
|
+
const left = Math.min(Math.max(preferredLeft, boundaryLeft), boundaryRight - popoverWidth);
|
|
9885
|
+
const belowTop = triggerRect.bottom + POPOVER_GAP;
|
|
9886
|
+
const belowSpace = Math.max(0, boundaryBottom - belowTop);
|
|
9887
|
+
const aboveSpace = Math.max(0, triggerRect.top - boundaryTop - POPOVER_GAP);
|
|
9888
|
+
const naturalHeight = Math.max(naturalRect.height, popover.scrollHeight);
|
|
9889
|
+
const placeBelow = belowSpace >= Math.min(naturalHeight, MIN_USABLE_HEIGHT) || belowSpace >= aboveSpace;
|
|
9890
|
+
const availableHeight = placeBelow ? belowSpace : aboveSpace;
|
|
9891
|
+
const maxHeight = Math.max(1, availableHeight);
|
|
9892
|
+
const renderedHeight = Math.min(naturalHeight, maxHeight);
|
|
9893
|
+
const top = placeBelow ? belowTop : Math.max(boundaryTop, triggerRect.top - POPOVER_GAP - renderedHeight);
|
|
9894
|
+
popover.style.left = `${left}px`;
|
|
9895
|
+
popover.style.top = `${top}px`;
|
|
9896
|
+
popover.style.maxHeight = `${maxHeight}px`;
|
|
9897
|
+
popover.dataset.placement = placeBelow ? "below" : "above";
|
|
9898
|
+
};
|
|
9899
|
+
const schedulePlacement = () => {
|
|
9900
|
+
if (frame !== null) {
|
|
9901
|
+
window.cancelAnimationFrame(frame);
|
|
9902
|
+
}
|
|
9903
|
+
frame = window.requestAnimationFrame(place);
|
|
9904
|
+
};
|
|
9905
|
+
const handleKeyDown = (event) => {
|
|
9906
|
+
if (event.key === "Escape") {
|
|
9907
|
+
event.preventDefault();
|
|
9908
|
+
event.stopPropagation();
|
|
9909
|
+
onClose();
|
|
9910
|
+
window.requestAnimationFrame(() => trigger.focus());
|
|
9911
|
+
return;
|
|
9912
|
+
}
|
|
9913
|
+
if (!["ArrowDown", "ArrowUp", "ArrowLeft", "ArrowRight", "Home", "End"].includes(event.key)) {
|
|
9914
|
+
return;
|
|
9915
|
+
}
|
|
9916
|
+
if (popover.getAttribute("role") === "dialog") {
|
|
9917
|
+
return;
|
|
9918
|
+
}
|
|
9919
|
+
const items = Array.from(
|
|
9920
|
+
popover.querySelectorAll('[role="menuitem"]:not([disabled]), [role="option"]:not([disabled])')
|
|
9921
|
+
).filter((item) => !item.hidden && item.getAttribute("aria-hidden") !== "true");
|
|
9922
|
+
if (items.length === 0 || event.target !== trigger && !popover.contains(event.target)) {
|
|
9923
|
+
return;
|
|
9924
|
+
}
|
|
9925
|
+
const currentIndex = items.indexOf(document.activeElement);
|
|
9926
|
+
let nextIndex;
|
|
9927
|
+
if (event.key === "Home") {
|
|
9928
|
+
nextIndex = 0;
|
|
9929
|
+
} else if (event.key === "End") {
|
|
9930
|
+
nextIndex = items.length - 1;
|
|
9931
|
+
} else if (event.key === "ArrowDown" || event.key === "ArrowRight") {
|
|
9932
|
+
nextIndex = currentIndex < 0 ? 0 : (currentIndex + 1) % items.length;
|
|
9933
|
+
} else {
|
|
9934
|
+
nextIndex = currentIndex < 0 ? items.length - 1 : (currentIndex - 1 + items.length) % items.length;
|
|
9935
|
+
}
|
|
9936
|
+
event.preventDefault();
|
|
9937
|
+
items[nextIndex]?.focus();
|
|
9938
|
+
};
|
|
9939
|
+
const closeOnOutsidePointer = (event) => {
|
|
9940
|
+
const target = event.target;
|
|
9941
|
+
if (target instanceof Node && !trigger.contains(target) && !popover.contains(target)) {
|
|
9942
|
+
onClose();
|
|
9943
|
+
}
|
|
9944
|
+
};
|
|
9945
|
+
const resizeObserver = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(schedulePlacement);
|
|
9946
|
+
resizeObserver?.observe(root);
|
|
9947
|
+
const toolbar = root.querySelector(".butex-widget__desktop-toolbar");
|
|
9948
|
+
if (toolbar) {
|
|
9949
|
+
resizeObserver?.observe(toolbar);
|
|
9950
|
+
}
|
|
9951
|
+
window.addEventListener("resize", schedulePlacement);
|
|
9952
|
+
window.addEventListener("scroll", schedulePlacement, true);
|
|
9953
|
+
window.visualViewport?.addEventListener("resize", schedulePlacement);
|
|
9954
|
+
window.visualViewport?.addEventListener("scroll", schedulePlacement);
|
|
9955
|
+
document.addEventListener("keydown", handleKeyDown, true);
|
|
9956
|
+
document.addEventListener("pointerdown", closeOnOutsidePointer, true);
|
|
9957
|
+
schedulePlacement();
|
|
9958
|
+
return () => {
|
|
9959
|
+
if (frame !== null) {
|
|
9960
|
+
window.cancelAnimationFrame(frame);
|
|
9961
|
+
}
|
|
9962
|
+
resizeObserver?.disconnect();
|
|
9963
|
+
window.removeEventListener("resize", schedulePlacement);
|
|
9964
|
+
window.removeEventListener("scroll", schedulePlacement, true);
|
|
9965
|
+
window.visualViewport?.removeEventListener("resize", schedulePlacement);
|
|
9966
|
+
window.visualViewport?.removeEventListener("scroll", schedulePlacement);
|
|
9967
|
+
document.removeEventListener("keydown", handleKeyDown, true);
|
|
9968
|
+
document.removeEventListener("pointerdown", closeOnOutsidePointer, true);
|
|
9969
|
+
clearPlacement(popover);
|
|
9970
|
+
};
|
|
9971
|
+
}, [active, onClose, rootRef]);
|
|
8625
9972
|
}
|
|
8626
9973
|
|
|
8627
9974
|
// src/react/ButexEditor.tsx
|
|
8628
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
9975
|
+
import { Fragment as Fragment2, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
8629
9976
|
var DIGIT_FORM_OPTIONS = [
|
|
8630
9977
|
{ id: "western", label: "456" },
|
|
8631
9978
|
{ id: "arabicIndic", label: "\u0664\u0665\u0666" },
|
|
8632
9979
|
{ id: "persianIndic", label: "\u06F4\u06F5\u06F6" }
|
|
8633
9980
|
];
|
|
8634
9981
|
var ACCENT_COMMANDS_LIST = accentCommandsList();
|
|
8635
|
-
var
|
|
8636
|
-
var
|
|
8637
|
-
var
|
|
8638
|
-
var
|
|
8639
|
-
var
|
|
8640
|
-
var
|
|
9982
|
+
var FUNCTION_COMMANDS2 = atomicCommandsByCategory("function");
|
|
9983
|
+
var LIMITS_SERIES_COMMANDS2 = atomicCommandsByCategory("limits_series");
|
|
9984
|
+
var FUNCTION2_COMMANDS2 = atomicCommandsByCategory("function2");
|
|
9985
|
+
var DERIVATIVE_COMMANDS2 = atomicCommandsByCategory("derivative");
|
|
9986
|
+
var GROUP_COMMANDS2 = atomicCommandsByCategory("groups");
|
|
9987
|
+
var SPACING_COMMANDS2 = atomicCommandsByCategory("spacing").filter(isSpacingCommandSpec);
|
|
8641
9988
|
var OPERATOR_COMMANDS = atomicOperatorCommandsByCategory("operators1");
|
|
8642
9989
|
var OPERATOR2_COMMANDS = atomicOperatorCommandsByCategory("operators2");
|
|
8643
9990
|
var OPERATOR3_COMMANDS = atomicOperatorCommandsByCategory("operators3");
|
|
8644
9991
|
var DOT_COMMANDS = atomicOperatorCommandsByCategory("dots");
|
|
8645
9992
|
var INTEGRAL_COMMANDS = atomicOperatorCommandsByCategory("integrals");
|
|
8646
|
-
var
|
|
9993
|
+
var MATRIX_STYLES2 = [
|
|
8647
9994
|
{ id: "matrix", label: "\u25A1" },
|
|
8648
9995
|
{ id: "pmatrix", label: "(\u25A1)" },
|
|
8649
9996
|
{ id: "bmatrix", label: "[\u25A1]" },
|
|
@@ -8651,15 +9998,15 @@ var MATRIX_STYLES = [
|
|
|
8651
9998
|
{ id: "vmatrix", label: "|\u25A1|" },
|
|
8652
9999
|
{ id: "Vmatrix", label: "||\u25A1||" }
|
|
8653
10000
|
];
|
|
8654
|
-
var
|
|
10001
|
+
var ARRAY_ALIGNMENTS2 = [
|
|
8655
10002
|
{ id: "l" },
|
|
8656
10003
|
{ id: "c" },
|
|
8657
10004
|
{ id: "r" }
|
|
8658
10005
|
];
|
|
8659
|
-
function
|
|
10006
|
+
function matrixSizeLabel2(rows, columns, messages) {
|
|
8660
10007
|
return `${String(rows)} ${messages.row} \xD7 ${String(columns)} ${messages.column}`;
|
|
8661
10008
|
}
|
|
8662
|
-
function
|
|
10009
|
+
function clampMatrixSize2(value) {
|
|
8663
10010
|
return Math.max(1, Math.min(12, Math.trunc(value)));
|
|
8664
10011
|
}
|
|
8665
10012
|
function digitFormLabel(digitForm) {
|
|
@@ -8668,7 +10015,7 @@ function digitFormLabel(digitForm) {
|
|
|
8668
10015
|
function characterFontOption(fontId) {
|
|
8669
10016
|
return CHARACTER_FONT_OPTIONS.find((option) => option.id === fontId) ?? CHARACTER_FONT_OPTIONS[0];
|
|
8670
10017
|
}
|
|
8671
|
-
function
|
|
10018
|
+
function characterFontTitle2(fontId, messages) {
|
|
8672
10019
|
const key = characterFontSpec(fontId).titleKey;
|
|
8673
10020
|
return messages[key] ?? messages.defaultFont;
|
|
8674
10021
|
}
|
|
@@ -8677,7 +10024,7 @@ function digitFormTitle(digitForm, messages) {
|
|
|
8677
10024
|
if (digitForm === "persianIndic") return messages.persianIndicDigits;
|
|
8678
10025
|
return messages.westernDigits;
|
|
8679
10026
|
}
|
|
8680
|
-
function
|
|
10027
|
+
function matrixStyleTitle2(style, messages) {
|
|
8681
10028
|
if (style === "pmatrix") return messages.matrixParentheses;
|
|
8682
10029
|
if (style === "bmatrix") return messages.matrixBrackets;
|
|
8683
10030
|
if (style === "Bmatrix") return messages.matrixBraces;
|
|
@@ -8690,7 +10037,7 @@ function alignmentCopy(alignment, messages) {
|
|
|
8690
10037
|
if (alignment === "r") return { label: messages.alignRight, title: messages.alignColumnRight };
|
|
8691
10038
|
return { label: messages.alignCenter, title: messages.alignColumnCenter };
|
|
8692
10039
|
}
|
|
8693
|
-
function
|
|
10040
|
+
function spacingArrow2(spec, side) {
|
|
8694
10041
|
const pointsWithFlow = spec.spacing.direction === "positive";
|
|
8695
10042
|
if (pointsWithFlow) {
|
|
8696
10043
|
return side === "arabic" ? "\u2190" : "\u2192";
|
|
@@ -8701,16 +10048,16 @@ function renderArabicCommandLabel(command) {
|
|
|
8701
10048
|
if (command.id !== "ln") {
|
|
8702
10049
|
return command.arabicLabel;
|
|
8703
10050
|
}
|
|
8704
|
-
return /* @__PURE__ */
|
|
8705
|
-
/* @__PURE__ */
|
|
8706
|
-
/* @__PURE__ */
|
|
10051
|
+
return /* @__PURE__ */ jsxs2("span", { className: "function-command-label-with-sub", "aria-hidden": "true", children: [
|
|
10052
|
+
/* @__PURE__ */ jsx2("span", { className: "function-command-label-with-sub__base", children: command.arabicLabel }),
|
|
10053
|
+
/* @__PURE__ */ jsx2("span", { className: "function-command-label-with-sub__sub", children: "\u0647\u0640" })
|
|
8707
10054
|
] });
|
|
8708
10055
|
}
|
|
8709
10056
|
function renderOperatorCommandLabel(command) {
|
|
8710
10057
|
if (!command.svg_path) {
|
|
8711
10058
|
return command.Label;
|
|
8712
10059
|
}
|
|
8713
|
-
return /* @__PURE__ */
|
|
10060
|
+
return /* @__PURE__ */ jsx2(
|
|
8714
10061
|
"span",
|
|
8715
10062
|
{
|
|
8716
10063
|
className: "operator-command-svg-label",
|
|
@@ -8726,7 +10073,7 @@ function renderOperatorMenuButtonLabel(command, fallback) {
|
|
|
8726
10073
|
if (!command) {
|
|
8727
10074
|
return fallback;
|
|
8728
10075
|
}
|
|
8729
|
-
return /* @__PURE__ */
|
|
10076
|
+
return /* @__PURE__ */ jsx2("span", { className: shouldMirrorOperatorDisplay(command) ? "operator-command-label operator-command-label--mirror" : "operator-command-label", children: renderOperatorCommandLabel(command) });
|
|
8730
10077
|
}
|
|
8731
10078
|
function passiveTreeText(session, messages) {
|
|
8732
10079
|
const passive = session.activeSide === "arabic" ? session.englishTree : session.arabicTree;
|
|
@@ -8737,62 +10084,99 @@ function passiveTreeText(session, messages) {
|
|
|
8737
10084
|
${latex || messages.empty}`;
|
|
8738
10085
|
}
|
|
8739
10086
|
var ButexEditor = forwardRef(
|
|
8740
|
-
function ButexEditor2({ className, debug = false, defaultSide, uiLocale = "ar", initialSession, onSessionChange }, ref) {
|
|
10087
|
+
function ButexEditor2({ className, debug = false, defaultSide, uiLocale = "ar", initialSession, onSessionChange, responsiveMode = "auto", showSideSwitcher = true }, ref) {
|
|
8741
10088
|
const messages = equationEditorMessages(uiLocale);
|
|
10089
|
+
const previewPanelId = useId2();
|
|
8742
10090
|
const debugEnabled = debug || typeof window !== "undefined" && new URLSearchParams(window.location.search).get("debug") === "1";
|
|
8743
|
-
const wrapperRef =
|
|
8744
|
-
const surfaceRef =
|
|
8745
|
-
const inputRef =
|
|
8746
|
-
const mathOutputRef =
|
|
8747
|
-
const renderErrorRef =
|
|
8748
|
-
const latexLinesRef =
|
|
8749
|
-
const passivePreviewRef =
|
|
8750
|
-
const debugLogRef =
|
|
8751
|
-
const undoBtnRef =
|
|
8752
|
-
const redoBtnRef =
|
|
8753
|
-
const copyBtnRef =
|
|
8754
|
-
const cutBtnRef =
|
|
8755
|
-
const splitTypingBtnRef =
|
|
8756
|
-
const characterFontBtnRef =
|
|
8757
|
-
const digitFormBtnRef =
|
|
8758
|
-
const runtimeRef =
|
|
8759
|
-
const debugRef =
|
|
10091
|
+
const wrapperRef = useRef3(null);
|
|
10092
|
+
const surfaceRef = useRef3(null);
|
|
10093
|
+
const inputRef = useRef3(null);
|
|
10094
|
+
const mathOutputRef = useRef3(null);
|
|
10095
|
+
const renderErrorRef = useRef3(null);
|
|
10096
|
+
const latexLinesRef = useRef3(null);
|
|
10097
|
+
const passivePreviewRef = useRef3(null);
|
|
10098
|
+
const debugLogRef = useRef3(null);
|
|
10099
|
+
const undoBtnRef = useRef3(null);
|
|
10100
|
+
const redoBtnRef = useRef3(null);
|
|
10101
|
+
const copyBtnRef = useRef3(null);
|
|
10102
|
+
const cutBtnRef = useRef3(null);
|
|
10103
|
+
const splitTypingBtnRef = useRef3(null);
|
|
10104
|
+
const characterFontBtnRef = useRef3(null);
|
|
10105
|
+
const digitFormBtnRef = useRef3(null);
|
|
10106
|
+
const runtimeRef = useRef3(null);
|
|
10107
|
+
const debugRef = useRef3(debug);
|
|
8760
10108
|
debugRef.current = debugEnabled;
|
|
8761
|
-
const uiLocaleRef =
|
|
10109
|
+
const uiLocaleRef = useRef3(uiLocale);
|
|
8762
10110
|
uiLocaleRef.current = uiLocale;
|
|
8763
|
-
const onSessionChangeRef =
|
|
10111
|
+
const onSessionChangeRef = useRef3(onSessionChange);
|
|
8764
10112
|
onSessionChangeRef.current = onSessionChange;
|
|
8765
|
-
const debugBodyHiddenRef =
|
|
8766
|
-
const [debugBodyHidden, setDebugBodyHidden] =
|
|
10113
|
+
const debugBodyHiddenRef = useRef3(false);
|
|
10114
|
+
const [debugBodyHidden, setDebugBodyHidden] = useState2(false);
|
|
8767
10115
|
debugBodyHiddenRef.current = debugBodyHidden;
|
|
8768
|
-
const [debugImportOpen, setDebugImportOpen] =
|
|
8769
|
-
const [debugImportText, setDebugImportText] =
|
|
8770
|
-
const [debugImportError, setDebugImportError] =
|
|
8771
|
-
const [
|
|
8772
|
-
const [
|
|
8773
|
-
const [
|
|
8774
|
-
const [
|
|
8775
|
-
const [
|
|
8776
|
-
const [
|
|
8777
|
-
|
|
8778
|
-
|
|
8779
|
-
|
|
8780
|
-
|
|
8781
|
-
|
|
8782
|
-
const [
|
|
8783
|
-
const [
|
|
8784
|
-
const [
|
|
8785
|
-
const [
|
|
8786
|
-
const [
|
|
8787
|
-
const [
|
|
8788
|
-
const
|
|
8789
|
-
|
|
8790
|
-
|
|
8791
|
-
|
|
8792
|
-
|
|
8793
|
-
|
|
8794
|
-
|
|
8795
|
-
|
|
10116
|
+
const [debugImportOpen, setDebugImportOpen] = useState2(false);
|
|
10117
|
+
const [debugImportText, setDebugImportText] = useState2("");
|
|
10118
|
+
const [debugImportError, setDebugImportError] = useState2("");
|
|
10119
|
+
const [openDesktopMenu, setOpenDesktopMenu] = useState2(null);
|
|
10120
|
+
const [selectedDigitForm2, setSelectedDigitForm] = useState2("western");
|
|
10121
|
+
const [selectedCharacterFont, setSelectedCharacterFont] = useState2("default");
|
|
10122
|
+
const [activeEditorSide, setActiveEditorSide] = useState2("arabic");
|
|
10123
|
+
const [compactPreviewOpen, setCompactPreviewOpen] = useState2(false);
|
|
10124
|
+
const [compactControlState, setCompactControlState] = useState2({
|
|
10125
|
+
canUndo: false,
|
|
10126
|
+
canRedo: false,
|
|
10127
|
+
hasSelection: false,
|
|
10128
|
+
splitLeafTyping: initialSession?.splitLeafTyping ?? true
|
|
10129
|
+
});
|
|
10130
|
+
const [envPaletteMode, setEnvPaletteMode] = useState2("matrix");
|
|
10131
|
+
const [matrixStyle, setMatrixStyle] = useState2("pmatrix");
|
|
10132
|
+
const [matrixRows, setMatrixRows] = useState2(2);
|
|
10133
|
+
const [matrixColumns, setMatrixColumns] = useState2(2);
|
|
10134
|
+
const [matrixHover, setMatrixHover] = useState2(null);
|
|
10135
|
+
const [arrayAlignmentColumn, setArrayAlignmentColumn] = useState2(1);
|
|
10136
|
+
const closeDesktopMenu = useCallback(() => setOpenDesktopMenu(null), []);
|
|
10137
|
+
useDesktopPopoverPlacement(wrapperRef, openDesktopMenu !== null, closeDesktopMenu);
|
|
10138
|
+
function desktopMenuOpen(menu) {
|
|
10139
|
+
return openDesktopMenu === menu;
|
|
10140
|
+
}
|
|
10141
|
+
function setDesktopMenuOpen(menu, value) {
|
|
10142
|
+
setOpenDesktopMenu((current) => {
|
|
10143
|
+
const isOpen = current === menu;
|
|
10144
|
+
const shouldOpen = typeof value === "function" ? value(isOpen) : value;
|
|
10145
|
+
return shouldOpen ? menu : isOpen ? null : current;
|
|
10146
|
+
});
|
|
10147
|
+
}
|
|
10148
|
+
const delimiterMenuOpen = desktopMenuOpen("delimiters");
|
|
10149
|
+
const matrixMenuOpen = desktopMenuOpen("matrix");
|
|
10150
|
+
const spacingMenuOpen = desktopMenuOpen("spacing");
|
|
10151
|
+
const functionMenuOpen = desktopMenuOpen("functions");
|
|
10152
|
+
const limitsSeriesMenuOpen = desktopMenuOpen("limitsSeries");
|
|
10153
|
+
const function2MenuOpen = desktopMenuOpen("functions2");
|
|
10154
|
+
const derivativeMenuOpen = desktopMenuOpen("derivatives");
|
|
10155
|
+
const groupMenuOpen = desktopMenuOpen("groups");
|
|
10156
|
+
const operatorMenuOpen = desktopMenuOpen("operators1");
|
|
10157
|
+
const operator2MenuOpen = desktopMenuOpen("operators2");
|
|
10158
|
+
const operator3MenuOpen = desktopMenuOpen("operators3");
|
|
10159
|
+
const dotMenuOpen = desktopMenuOpen("dots");
|
|
10160
|
+
const accentMenuOpen = desktopMenuOpen("accents");
|
|
10161
|
+
const integralMenuOpen = desktopMenuOpen("integrals");
|
|
10162
|
+
const characterFontMenuOpen = desktopMenuOpen("font");
|
|
10163
|
+
const digitMenuOpen = desktopMenuOpen("digits");
|
|
10164
|
+
const setDelimiterMenuOpen = (value) => setDesktopMenuOpen("delimiters", value);
|
|
10165
|
+
const setMatrixMenuOpen = (value) => setDesktopMenuOpen("matrix", value);
|
|
10166
|
+
const setSpacingMenuOpen = (value) => setDesktopMenuOpen("spacing", value);
|
|
10167
|
+
const setFunctionMenuOpen = (value) => setDesktopMenuOpen("functions", value);
|
|
10168
|
+
const setLimitsSeriesMenuOpen = (value) => setDesktopMenuOpen("limitsSeries", value);
|
|
10169
|
+
const setFunction2MenuOpen = (value) => setDesktopMenuOpen("functions2", value);
|
|
10170
|
+
const setDerivativeMenuOpen = (value) => setDesktopMenuOpen("derivatives", value);
|
|
10171
|
+
const setGroupMenuOpen = (value) => setDesktopMenuOpen("groups", value);
|
|
10172
|
+
const setOperatorMenuOpen = (value) => setDesktopMenuOpen("operators1", value);
|
|
10173
|
+
const setOperator2MenuOpen = (value) => setDesktopMenuOpen("operators2", value);
|
|
10174
|
+
const setOperator3MenuOpen = (value) => setDesktopMenuOpen("operators3", value);
|
|
10175
|
+
const setDotMenuOpen = (value) => setDesktopMenuOpen("dots", value);
|
|
10176
|
+
const setAccentMenuOpen = (value) => setDesktopMenuOpen("accents", value);
|
|
10177
|
+
const setIntegralMenuOpen = (value) => setDesktopMenuOpen("integrals", value);
|
|
10178
|
+
const setCharacterFontMenuOpen = (value) => setDesktopMenuOpen("font", value);
|
|
10179
|
+
const setDigitMenuOpen = (value) => setDesktopMenuOpen("digits", value);
|
|
8796
10180
|
useImperativeHandle(ref, () => ({
|
|
8797
10181
|
getRuntime: () => runtimeRef.current
|
|
8798
10182
|
}));
|
|
@@ -8846,7 +10230,7 @@ ${arabic || currentMessages.empty}`;
|
|
|
8846
10230
|
}
|
|
8847
10231
|
}
|
|
8848
10232
|
}, []);
|
|
8849
|
-
const updatePreviewRef =
|
|
10233
|
+
const updatePreviewRef = useRef3(updatePreview);
|
|
8850
10234
|
updatePreviewRef.current = updatePreview;
|
|
8851
10235
|
async function copyDebugText(text) {
|
|
8852
10236
|
try {
|
|
@@ -8896,7 +10280,7 @@ ${arabic || currentMessages.empty}`;
|
|
|
8896
10280
|
setDebugImportError(importError instanceof Error ? importError.message : String(importError));
|
|
8897
10281
|
}
|
|
8898
10282
|
}
|
|
8899
|
-
|
|
10283
|
+
useEffect4(() => {
|
|
8900
10284
|
injectWidgetChromeCss();
|
|
8901
10285
|
injectBuTeXEditorStyles(typeof document !== "undefined" ? document : void 0);
|
|
8902
10286
|
const surfaceEl = surfaceRef.current;
|
|
@@ -8917,11 +10301,28 @@ ${arabic || currentMessages.empty}`;
|
|
|
8917
10301
|
splitTypingBtn: splitTypingBtnRef.current,
|
|
8918
10302
|
digitFormBtn: digitFormBtnRef.current
|
|
8919
10303
|
},
|
|
8920
|
-
outsidePointerIgnoreSelectors: [
|
|
10304
|
+
outsidePointerIgnoreSelectors: [
|
|
10305
|
+
".butex-widget .toolbar",
|
|
10306
|
+
".butex-widget__mobile-toolbar",
|
|
10307
|
+
".butex-widget__command-sheet-backdrop",
|
|
10308
|
+
"#btn-copy",
|
|
10309
|
+
"#btn-cut",
|
|
10310
|
+
"#btn-paste"
|
|
10311
|
+
],
|
|
8921
10312
|
onSessionChange: (session) => {
|
|
8922
10313
|
setSelectedDigitForm(session.currentDigitForm ?? "western");
|
|
8923
10314
|
setSelectedCharacterFont(session.currentCharacterFont ?? "default");
|
|
8924
10315
|
setActiveEditorSide(session.activeSide);
|
|
10316
|
+
const hasSelection = Boolean(session.selection && session.selection.anchorIndex !== session.selection.focusIndex);
|
|
10317
|
+
const nextCompactState = {
|
|
10318
|
+
canUndo: undoBtnRef.current?.disabled === false,
|
|
10319
|
+
canRedo: redoBtnRef.current?.disabled === false,
|
|
10320
|
+
hasSelection,
|
|
10321
|
+
splitLeafTyping: session.splitLeafTyping
|
|
10322
|
+
};
|
|
10323
|
+
setCompactControlState(
|
|
10324
|
+
(current) => current.canUndo === nextCompactState.canUndo && current.canRedo === nextCompactState.canRedo && current.hasSelection === nextCompactState.hasSelection && current.splitLeafTyping === nextCompactState.splitLeafTyping ? current : nextCompactState
|
|
10325
|
+
);
|
|
8925
10326
|
onSessionChangeRef.current?.(session);
|
|
8926
10327
|
void updatePreviewRef.current(session).catch((err) => {
|
|
8927
10328
|
const message = err instanceof Error ? err.message : String(err);
|
|
@@ -8934,6 +10335,19 @@ ${arabic || currentMessages.empty}`;
|
|
|
8934
10335
|
}
|
|
8935
10336
|
});
|
|
8936
10337
|
runtimeRef.current = runtime;
|
|
10338
|
+
let viewportRevealFrame = null;
|
|
10339
|
+
const stopViewportObserver = observeVisibleViewport(window, (change) => {
|
|
10340
|
+
if (change.initial || !change.sizeChanged && change.reason !== "orientation") {
|
|
10341
|
+
return;
|
|
10342
|
+
}
|
|
10343
|
+
if (viewportRevealFrame !== null) {
|
|
10344
|
+
window.cancelAnimationFrame(viewportRevealFrame);
|
|
10345
|
+
}
|
|
10346
|
+
viewportRevealFrame = window.requestAnimationFrame(() => {
|
|
10347
|
+
viewportRevealFrame = null;
|
|
10348
|
+
revealCaretInSurface(surfaceEl);
|
|
10349
|
+
});
|
|
10350
|
+
});
|
|
8937
10351
|
if (typeof window !== "undefined" && window.MathJax?.startup?.promise) {
|
|
8938
10352
|
window.MathJax.startup.promise.then(() => {
|
|
8939
10353
|
runtime.render();
|
|
@@ -8949,11 +10363,15 @@ ${arabic || currentMessages.empty}`;
|
|
|
8949
10363
|
}
|
|
8950
10364
|
runtime.focusInput();
|
|
8951
10365
|
return () => {
|
|
10366
|
+
stopViewportObserver();
|
|
10367
|
+
if (viewportRevealFrame !== null) {
|
|
10368
|
+
window.cancelAnimationFrame(viewportRevealFrame);
|
|
10369
|
+
}
|
|
8952
10370
|
runtime.destroy();
|
|
8953
10371
|
runtimeRef.current = null;
|
|
8954
10372
|
};
|
|
8955
10373
|
}, []);
|
|
8956
|
-
|
|
10374
|
+
useEffect4(() => {
|
|
8957
10375
|
runtimeRef.current?.setUiLocale(uiLocale);
|
|
8958
10376
|
const session = runtimeRef.current?.getSession();
|
|
8959
10377
|
if (session) {
|
|
@@ -8972,24 +10390,43 @@ ${arabic || currentMessages.empty}`;
|
|
|
8972
10390
|
runtimeRef.current?.insertMatrixEnv(matrixStyle, rows, columns);
|
|
8973
10391
|
}
|
|
8974
10392
|
}
|
|
8975
|
-
|
|
10393
|
+
const compactToolbarState = {
|
|
10394
|
+
...compactControlState,
|
|
10395
|
+
activeSide: activeEditorSide,
|
|
10396
|
+
characterFont: selectedCharacterFont,
|
|
10397
|
+
digitForm: selectedDigitForm2
|
|
10398
|
+
};
|
|
10399
|
+
return /* @__PURE__ */ jsx2(
|
|
8976
10400
|
"div",
|
|
8977
10401
|
{
|
|
8978
10402
|
ref: wrapperRef,
|
|
8979
10403
|
className: `butex-widget ${className ?? ""}`.trim(),
|
|
10404
|
+
"data-compact-preview": compactPreviewOpen ? "open" : "closed",
|
|
10405
|
+
"data-responsive-mode": responsiveMode,
|
|
8980
10406
|
dir: uiLocaleDirection(uiLocale),
|
|
8981
10407
|
lang: uiLocale,
|
|
8982
|
-
children: /* @__PURE__ */
|
|
8983
|
-
/* @__PURE__ */
|
|
8984
|
-
/* @__PURE__ */
|
|
8985
|
-
|
|
8986
|
-
|
|
8987
|
-
|
|
10408
|
+
children: /* @__PURE__ */ jsxs2("div", { className: "butex-widget-layout", children: [
|
|
10409
|
+
/* @__PURE__ */ jsxs2("section", { className: "panel panel-editor", children: [
|
|
10410
|
+
/* @__PURE__ */ jsx2(
|
|
10411
|
+
EquationMobileToolbar,
|
|
10412
|
+
{
|
|
10413
|
+
uiLocale,
|
|
10414
|
+
messages,
|
|
10415
|
+
state: compactToolbarState,
|
|
10416
|
+
showSideSwitcher,
|
|
10417
|
+
inputRef,
|
|
10418
|
+
getRuntime: () => runtimeRef.current
|
|
10419
|
+
}
|
|
10420
|
+
),
|
|
10421
|
+
/* @__PURE__ */ jsxs2("div", { className: "toolbar butex-widget__desktop-toolbar", children: [
|
|
10422
|
+
/* @__PURE__ */ jsxs2("div", { className: "toolbar-group toolbar-history", role: "group", "aria-label": messages.undoRedo, children: [
|
|
10423
|
+
/* @__PURE__ */ jsx2("button", { ref: undoBtnRef, id: "btn-undo", type: "button", className: "icon-btn", title: messages.undo, "aria-label": messages.undo, children: "\u21B7" }),
|
|
10424
|
+
/* @__PURE__ */ jsx2("button", { ref: redoBtnRef, id: "btn-redo", type: "button", className: "icon-btn", title: messages.redo, "aria-label": messages.redo, children: "\u21B6" })
|
|
8988
10425
|
] }),
|
|
8989
|
-
/* @__PURE__ */
|
|
8990
|
-
/* @__PURE__ */
|
|
8991
|
-
/* @__PURE__ */
|
|
8992
|
-
/* @__PURE__ */
|
|
10426
|
+
/* @__PURE__ */ jsxs2("div", { className: "toolbar-group toolbar-clipboard", role: "group", "aria-label": messages.clipboard, children: [
|
|
10427
|
+
/* @__PURE__ */ jsx2("button", { ref: copyBtnRef, id: "btn-copy", type: "button", className: "icon-btn", title: messages.copy, "aria-label": messages.copy, disabled: true, children: "\u29C9" }),
|
|
10428
|
+
/* @__PURE__ */ jsx2("button", { ref: cutBtnRef, id: "btn-cut", type: "button", className: "icon-btn", title: messages.cut, "aria-label": messages.cut, disabled: true, children: "\u2702" }),
|
|
10429
|
+
/* @__PURE__ */ jsx2(
|
|
8993
10430
|
"button",
|
|
8994
10431
|
{
|
|
8995
10432
|
id: "btn-paste",
|
|
@@ -9006,9 +10443,9 @@ ${arabic || currentMessages.empty}`;
|
|
|
9006
10443
|
}
|
|
9007
10444
|
)
|
|
9008
10445
|
] }),
|
|
9009
|
-
/* @__PURE__ */
|
|
9010
|
-
/* @__PURE__ */
|
|
9011
|
-
/* @__PURE__ */
|
|
10446
|
+
showSideSwitcher ? /* @__PURE__ */ jsx2("div", { className: "toolbar-group toolbar-settings", role: "group", "aria-label": messages.editorSettings, children: /* @__PURE__ */ jsx2("button", { className: "icon-btn accent", type: "button", title: messages.toggleSide, "aria-label": messages.toggleSide, onClick: () => runtimeRef.current?.toggleSide(), children: "\u21C4" }) }) : null,
|
|
10447
|
+
/* @__PURE__ */ jsxs2("div", { className: "toolbar-group toolbar-structures", role: "group", "aria-label": messages.structures, children: [
|
|
10448
|
+
/* @__PURE__ */ jsxs2(
|
|
9012
10449
|
"div",
|
|
9013
10450
|
{
|
|
9014
10451
|
className: "delimiter-command-menu",
|
|
@@ -9019,27 +10456,27 @@ ${arabic || currentMessages.empty}`;
|
|
|
9019
10456
|
}
|
|
9020
10457
|
},
|
|
9021
10458
|
children: [
|
|
9022
|
-
/* @__PURE__ */
|
|
10459
|
+
/* @__PURE__ */ jsx2(
|
|
9023
10460
|
"button",
|
|
9024
10461
|
{
|
|
9025
10462
|
className: "icon-btn delimiter-command-btn",
|
|
9026
10463
|
type: "button",
|
|
9027
10464
|
title: messages.insertDelimiters,
|
|
9028
10465
|
"aria-label": messages.insertDelimiters,
|
|
9029
|
-
"aria-haspopup": "
|
|
10466
|
+
"aria-haspopup": "menu",
|
|
9030
10467
|
"aria-expanded": delimiterMenuOpen,
|
|
9031
10468
|
onClick: () => setDelimiterMenuOpen((open) => !open),
|
|
9032
10469
|
children: "()"
|
|
9033
10470
|
}
|
|
9034
10471
|
),
|
|
9035
|
-
/* @__PURE__ */
|
|
9036
|
-
/* @__PURE__ */
|
|
10472
|
+
/* @__PURE__ */ jsxs2("div", { className: "delimiter-command-options", role: "menu", "aria-label": messages.insertDelimiters, hidden: !delimiterMenuOpen, children: [
|
|
10473
|
+
/* @__PURE__ */ jsx2(
|
|
9037
10474
|
"button",
|
|
9038
10475
|
{
|
|
9039
10476
|
className: "delimiter-command-option",
|
|
9040
10477
|
"data-delim": "paren",
|
|
9041
10478
|
type: "button",
|
|
9042
|
-
role: "
|
|
10479
|
+
role: "menuitem",
|
|
9043
10480
|
title: messages.insertParentheses,
|
|
9044
10481
|
"aria-label": messages.insertParentheses,
|
|
9045
10482
|
onMouseDown: (event) => event.preventDefault(),
|
|
@@ -9051,13 +10488,13 @@ ${arabic || currentMessages.empty}`;
|
|
|
9051
10488
|
children: "()"
|
|
9052
10489
|
}
|
|
9053
10490
|
),
|
|
9054
|
-
/* @__PURE__ */
|
|
10491
|
+
/* @__PURE__ */ jsx2(
|
|
9055
10492
|
"button",
|
|
9056
10493
|
{
|
|
9057
10494
|
className: "delimiter-command-option",
|
|
9058
10495
|
"data-delim": "bracket",
|
|
9059
10496
|
type: "button",
|
|
9060
|
-
role: "
|
|
10497
|
+
role: "menuitem",
|
|
9061
10498
|
title: messages.insertBrackets,
|
|
9062
10499
|
"aria-label": messages.insertBrackets,
|
|
9063
10500
|
onMouseDown: (event) => event.preventDefault(),
|
|
@@ -9069,13 +10506,13 @@ ${arabic || currentMessages.empty}`;
|
|
|
9069
10506
|
children: "[]"
|
|
9070
10507
|
}
|
|
9071
10508
|
),
|
|
9072
|
-
/* @__PURE__ */
|
|
10509
|
+
/* @__PURE__ */ jsx2(
|
|
9073
10510
|
"button",
|
|
9074
10511
|
{
|
|
9075
10512
|
className: "delimiter-command-option",
|
|
9076
10513
|
"data-delim": "brace",
|
|
9077
10514
|
type: "button",
|
|
9078
|
-
role: "
|
|
10515
|
+
role: "menuitem",
|
|
9079
10516
|
title: messages.insertBraces,
|
|
9080
10517
|
"aria-label": messages.insertBraces,
|
|
9081
10518
|
onMouseDown: (event) => event.preventDefault(),
|
|
@@ -9091,40 +10528,40 @@ ${arabic || currentMessages.empty}`;
|
|
|
9091
10528
|
]
|
|
9092
10529
|
}
|
|
9093
10530
|
),
|
|
9094
|
-
/* @__PURE__ */
|
|
10531
|
+
/* @__PURE__ */ jsx2("button", { id: "insert-frac", className: "icon-btn frac-icon-btn", type: "button", title: messages.insertFraction, "aria-label": messages.insertFraction, onClick: () => {
|
|
9095
10532
|
runtimeRef.current?.insertFraction();
|
|
9096
10533
|
focusSurface();
|
|
9097
|
-
}, children: /* @__PURE__ */
|
|
9098
|
-
/* @__PURE__ */
|
|
9099
|
-
/* @__PURE__ */
|
|
10534
|
+
}, children: /* @__PURE__ */ jsxs2("span", { className: "toolbar-frac-icon", "aria-hidden": "true", children: [
|
|
10535
|
+
/* @__PURE__ */ jsx2("span", { children: "\u0623" }),
|
|
10536
|
+
/* @__PURE__ */ jsx2("span", { children: "\u0628" })
|
|
9100
10537
|
] }) }),
|
|
9101
|
-
/* @__PURE__ */
|
|
10538
|
+
/* @__PURE__ */ jsx2("button", { id: "insert-sqrt", className: "icon-btn", type: "button", title: messages.insertRoot, "aria-label": messages.insertRoot, onClick: () => {
|
|
9102
10539
|
runtimeRef.current?.insertSqrt();
|
|
9103
10540
|
focusSurface();
|
|
9104
|
-
}, children: /* @__PURE__ */
|
|
9105
|
-
/* @__PURE__ */
|
|
10541
|
+
}, children: /* @__PURE__ */ jsx2("span", { className: "toolbar-sqrt-icon", "aria-hidden": "true", children: "\u221A" }) }),
|
|
10542
|
+
/* @__PURE__ */ jsx2("button", { id: "insert-overset", className: "icon-btn", type: "button", title: messages.insertOverset, "aria-label": messages.insertOverset, onClick: () => {
|
|
9106
10543
|
runtimeRef.current?.insertOverset();
|
|
9107
10544
|
focusSurface();
|
|
9108
|
-
}, children: /* @__PURE__ */
|
|
9109
|
-
/* @__PURE__ */
|
|
9110
|
-
/* @__PURE__ */
|
|
10545
|
+
}, children: /* @__PURE__ */ jsxs2("span", { className: "toolbar-accent-icon toolbar-accent-icon--over", "aria-hidden": "true", children: [
|
|
10546
|
+
/* @__PURE__ */ jsx2("span", { children: "\u2217" }),
|
|
10547
|
+
/* @__PURE__ */ jsx2("span", { children: "\u25A1" })
|
|
9111
10548
|
] }) }),
|
|
9112
|
-
/* @__PURE__ */
|
|
10549
|
+
/* @__PURE__ */ jsx2("button", { id: "insert-underset", className: "icon-btn", type: "button", title: messages.insertUnderset, "aria-label": messages.insertUnderset, onClick: () => {
|
|
9113
10550
|
runtimeRef.current?.insertUnderset();
|
|
9114
10551
|
focusSurface();
|
|
9115
|
-
}, children: /* @__PURE__ */
|
|
9116
|
-
/* @__PURE__ */
|
|
9117
|
-
/* @__PURE__ */
|
|
10552
|
+
}, children: /* @__PURE__ */ jsxs2("span", { className: "toolbar-accent-icon toolbar-accent-icon--under", "aria-hidden": "true", children: [
|
|
10553
|
+
/* @__PURE__ */ jsx2("span", { children: "\u25A1" }),
|
|
10554
|
+
/* @__PURE__ */ jsx2("span", { children: "\u2217" })
|
|
9118
10555
|
] }) }),
|
|
9119
|
-
/* @__PURE__ */
|
|
10556
|
+
/* @__PURE__ */ jsx2("button", { id: "insert-accent-pair", className: "icon-btn", type: "button", title: messages.insertAccentPair, "aria-label": messages.insertAccentPair, onClick: () => {
|
|
9120
10557
|
runtimeRef.current?.insertAccentPair();
|
|
9121
10558
|
focusSurface();
|
|
9122
|
-
}, children: /* @__PURE__ */
|
|
9123
|
-
/* @__PURE__ */
|
|
9124
|
-
/* @__PURE__ */
|
|
9125
|
-
/* @__PURE__ */
|
|
10559
|
+
}, children: /* @__PURE__ */ jsxs2("span", { className: "toolbar-accent-icon toolbar-accent-icon--pair", "aria-hidden": "true", children: [
|
|
10560
|
+
/* @__PURE__ */ jsx2("span", { children: "\u2217" }),
|
|
10561
|
+
/* @__PURE__ */ jsx2("span", { children: "\u25A1" }),
|
|
10562
|
+
/* @__PURE__ */ jsx2("span", { children: "\u2217" })
|
|
9126
10563
|
] }) }),
|
|
9127
|
-
/* @__PURE__ */
|
|
10564
|
+
/* @__PURE__ */ jsxs2(
|
|
9128
10565
|
"div",
|
|
9129
10566
|
{
|
|
9130
10567
|
className: "function-command-menu operator-command-menu",
|
|
@@ -9135,7 +10572,7 @@ ${arabic || currentMessages.empty}`;
|
|
|
9135
10572
|
}
|
|
9136
10573
|
},
|
|
9137
10574
|
children: [
|
|
9138
|
-
/* @__PURE__ */
|
|
10575
|
+
/* @__PURE__ */ jsx2(
|
|
9139
10576
|
"button",
|
|
9140
10577
|
{
|
|
9141
10578
|
id: "insert-accents",
|
|
@@ -9143,21 +10580,21 @@ ${arabic || currentMessages.empty}`;
|
|
|
9143
10580
|
type: "button",
|
|
9144
10581
|
title: messages.insertAccents,
|
|
9145
10582
|
"aria-label": messages.insertAccents,
|
|
9146
|
-
"aria-haspopup": "
|
|
10583
|
+
"aria-haspopup": "menu",
|
|
9147
10584
|
"aria-expanded": accentMenuOpen,
|
|
9148
10585
|
onClick: () => setAccentMenuOpen((open) => !open),
|
|
9149
|
-
children: /* @__PURE__ */
|
|
9150
|
-
/* @__PURE__ */
|
|
9151
|
-
/* @__PURE__ */
|
|
10586
|
+
children: /* @__PURE__ */ jsxs2("span", { className: "toolbar-accent-icon toolbar-accent-icon--over", "aria-hidden": "true", children: [
|
|
10587
|
+
/* @__PURE__ */ jsx2("span", { children: "\u02C6" }),
|
|
10588
|
+
/* @__PURE__ */ jsx2("span", { children: "\u25A1" })
|
|
9152
10589
|
] })
|
|
9153
10590
|
}
|
|
9154
10591
|
),
|
|
9155
|
-
/* @__PURE__ */
|
|
10592
|
+
/* @__PURE__ */ jsx2("div", { className: "function-command-options operator-command-options", role: "menu", "aria-label": messages.insertAccents, hidden: !accentMenuOpen, children: ACCENT_COMMANDS_LIST.map((command) => /* @__PURE__ */ jsx2(
|
|
9156
10593
|
"button",
|
|
9157
10594
|
{
|
|
9158
10595
|
className: "function-command-option operator-command-option",
|
|
9159
10596
|
type: "button",
|
|
9160
|
-
role: "
|
|
10597
|
+
role: "menuitem",
|
|
9161
10598
|
title: accentCommandTitle(command, uiLocale),
|
|
9162
10599
|
"aria-label": accentCommandTitle(command, uiLocale),
|
|
9163
10600
|
onMouseDown: (event) => event.preventDefault(),
|
|
@@ -9166,7 +10603,7 @@ ${arabic || currentMessages.empty}`;
|
|
|
9166
10603
|
setAccentMenuOpen(false);
|
|
9167
10604
|
focusSurface();
|
|
9168
10605
|
},
|
|
9169
|
-
children: /* @__PURE__ */
|
|
10606
|
+
children: /* @__PURE__ */ jsx2("span", { className: "operator-command-label", children: command.label })
|
|
9170
10607
|
},
|
|
9171
10608
|
command.id
|
|
9172
10609
|
)) })
|
|
@@ -9174,7 +10611,7 @@ ${arabic || currentMessages.empty}`;
|
|
|
9174
10611
|
}
|
|
9175
10612
|
)
|
|
9176
10613
|
] }),
|
|
9177
|
-
/* @__PURE__ */
|
|
10614
|
+
/* @__PURE__ */ jsx2("div", { className: "toolbar-group toolbar-environments", role: "group", "aria-label": messages.environments, children: /* @__PURE__ */ jsxs2(
|
|
9178
10615
|
"div",
|
|
9179
10616
|
{
|
|
9180
10617
|
className: "matrix-command-menu",
|
|
@@ -9185,7 +10622,7 @@ ${arabic || currentMessages.empty}`;
|
|
|
9185
10622
|
}
|
|
9186
10623
|
},
|
|
9187
10624
|
children: [
|
|
9188
|
-
/* @__PURE__ */
|
|
10625
|
+
/* @__PURE__ */ jsx2(
|
|
9189
10626
|
"button",
|
|
9190
10627
|
{
|
|
9191
10628
|
className: "icon-btn matrix-command-btn",
|
|
@@ -9195,20 +10632,20 @@ ${arabic || currentMessages.empty}`;
|
|
|
9195
10632
|
"aria-haspopup": "dialog",
|
|
9196
10633
|
"aria-expanded": matrixMenuOpen,
|
|
9197
10634
|
onClick: () => setMatrixMenuOpen((open) => !open),
|
|
9198
|
-
children: /* @__PURE__ */
|
|
9199
|
-
/* @__PURE__ */
|
|
9200
|
-
/* @__PURE__ */
|
|
9201
|
-
/* @__PURE__ */
|
|
9202
|
-
/* @__PURE__ */
|
|
10635
|
+
children: /* @__PURE__ */ jsxs2("span", { className: "toolbar-matrix-icon", "aria-hidden": "true", children: [
|
|
10636
|
+
/* @__PURE__ */ jsx2("span", {}),
|
|
10637
|
+
/* @__PURE__ */ jsx2("span", {}),
|
|
10638
|
+
/* @__PURE__ */ jsx2("span", {}),
|
|
10639
|
+
/* @__PURE__ */ jsx2("span", {})
|
|
9203
10640
|
] })
|
|
9204
10641
|
}
|
|
9205
10642
|
),
|
|
9206
|
-
/* @__PURE__ */
|
|
9207
|
-
/* @__PURE__ */
|
|
10643
|
+
/* @__PURE__ */ jsxs2("div", { className: "matrix-command-popover", role: "dialog", "aria-label": messages.insertEnvironment, hidden: !matrixMenuOpen, children: [
|
|
10644
|
+
/* @__PURE__ */ jsx2("div", { className: "matrix-style-options", role: "listbox", "aria-label": messages.environmentType, children: [
|
|
9208
10645
|
{ id: "matrix", label: messages.matrix },
|
|
9209
10646
|
{ id: "array", label: messages.array },
|
|
9210
10647
|
{ id: "aligned", label: messages.aligned }
|
|
9211
|
-
].map((option) => /* @__PURE__ */
|
|
10648
|
+
].map((option) => /* @__PURE__ */ jsx2(
|
|
9212
10649
|
"button",
|
|
9213
10650
|
{
|
|
9214
10651
|
type: "button",
|
|
@@ -9226,14 +10663,14 @@ ${arabic || currentMessages.empty}`;
|
|
|
9226
10663
|
},
|
|
9227
10664
|
option.id
|
|
9228
10665
|
)) }),
|
|
9229
|
-
envPaletteMode === "matrix" ? /* @__PURE__ */
|
|
10666
|
+
envPaletteMode === "matrix" ? /* @__PURE__ */ jsx2("div", { className: "matrix-style-options", role: "listbox", "aria-label": messages.matrixType, children: MATRIX_STYLES2.map((style) => /* @__PURE__ */ jsx2(
|
|
9230
10667
|
"button",
|
|
9231
10668
|
{
|
|
9232
10669
|
type: "button",
|
|
9233
10670
|
role: "option",
|
|
9234
10671
|
"aria-selected": matrixStyle === style.id,
|
|
9235
10672
|
className: "matrix-style-option",
|
|
9236
|
-
title:
|
|
10673
|
+
title: matrixStyleTitle2(style.id, messages),
|
|
9237
10674
|
onMouseDown: (event) => event.preventDefault(),
|
|
9238
10675
|
onClick: () => {
|
|
9239
10676
|
setMatrixStyle(style.id);
|
|
@@ -9242,21 +10679,21 @@ ${arabic || currentMessages.empty}`;
|
|
|
9242
10679
|
},
|
|
9243
10680
|
style.id
|
|
9244
10681
|
)) }) : null,
|
|
9245
|
-
/* @__PURE__ */
|
|
9246
|
-
/* @__PURE__ */
|
|
10682
|
+
/* @__PURE__ */ jsx2("div", { className: "matrix-size-readout", children: matrixHover ? matrixSizeLabel2(matrixHover.rows, matrixHover.columns, messages) : matrixSizeLabel2(matrixRows, matrixColumns, messages) }),
|
|
10683
|
+
/* @__PURE__ */ jsx2("div", { className: "matrix-grid-picker", "aria-label": messages.chooseEnvironmentSize, children: Array.from(
|
|
9247
10684
|
{ length: 8 },
|
|
9248
10685
|
(_, rowIndex) => Array.from({ length: 8 }, (_2, columnIndex) => {
|
|
9249
10686
|
const rows = rowIndex + 1;
|
|
9250
10687
|
const columns = columnIndex + 1;
|
|
9251
10688
|
const activeRows = matrixHover?.rows ?? matrixRows;
|
|
9252
10689
|
const activeColumns = matrixHover?.columns ?? matrixColumns;
|
|
9253
|
-
return /* @__PURE__ */
|
|
10690
|
+
return /* @__PURE__ */ jsx2(
|
|
9254
10691
|
"button",
|
|
9255
10692
|
{
|
|
9256
10693
|
type: "button",
|
|
9257
10694
|
className: rows <= activeRows && columns <= activeColumns ? "matrix-grid-cell active" : "matrix-grid-cell",
|
|
9258
|
-
title:
|
|
9259
|
-
"aria-label":
|
|
10695
|
+
title: matrixSizeLabel2(rows, columns, messages),
|
|
10696
|
+
"aria-label": matrixSizeLabel2(rows, columns, messages),
|
|
9260
10697
|
onMouseEnter: () => setMatrixHover({ rows, columns }),
|
|
9261
10698
|
onMouseDown: (event) => event.preventDefault(),
|
|
9262
10699
|
onClick: () => {
|
|
@@ -9272,42 +10709,42 @@ ${arabic || currentMessages.empty}`;
|
|
|
9272
10709
|
);
|
|
9273
10710
|
})
|
|
9274
10711
|
) }),
|
|
9275
|
-
/* @__PURE__ */
|
|
9276
|
-
/* @__PURE__ */
|
|
10712
|
+
/* @__PURE__ */ jsxs2("div", { className: "matrix-custom-size", children: [
|
|
10713
|
+
/* @__PURE__ */ jsxs2("label", { children: [
|
|
9277
10714
|
messages.row,
|
|
9278
|
-
/* @__PURE__ */
|
|
10715
|
+
/* @__PURE__ */ jsx2(
|
|
9279
10716
|
"input",
|
|
9280
10717
|
{
|
|
9281
10718
|
type: "number",
|
|
9282
10719
|
min: 1,
|
|
9283
10720
|
max: 12,
|
|
9284
10721
|
value: matrixRows,
|
|
9285
|
-
onChange: (event) => setMatrixRows(
|
|
10722
|
+
onChange: (event) => setMatrixRows(clampMatrixSize2(Number(event.currentTarget.value) || 1))
|
|
9286
10723
|
}
|
|
9287
10724
|
)
|
|
9288
10725
|
] }),
|
|
9289
|
-
/* @__PURE__ */
|
|
10726
|
+
/* @__PURE__ */ jsxs2("label", { children: [
|
|
9290
10727
|
messages.column,
|
|
9291
|
-
/* @__PURE__ */
|
|
10728
|
+
/* @__PURE__ */ jsx2(
|
|
9292
10729
|
"input",
|
|
9293
10730
|
{
|
|
9294
10731
|
type: "number",
|
|
9295
10732
|
min: 1,
|
|
9296
10733
|
max: 12,
|
|
9297
10734
|
value: matrixColumns,
|
|
9298
|
-
onChange: (event) => setMatrixColumns(
|
|
10735
|
+
onChange: (event) => setMatrixColumns(clampMatrixSize2(Number(event.currentTarget.value) || 1))
|
|
9299
10736
|
}
|
|
9300
10737
|
)
|
|
9301
10738
|
] }),
|
|
9302
|
-
/* @__PURE__ */
|
|
10739
|
+
/* @__PURE__ */ jsx2(
|
|
9303
10740
|
"button",
|
|
9304
10741
|
{
|
|
9305
10742
|
type: "button",
|
|
9306
10743
|
className: "matrix-insert-custom",
|
|
9307
10744
|
onMouseDown: (event) => event.preventDefault(),
|
|
9308
10745
|
onClick: () => {
|
|
9309
|
-
const rows =
|
|
9310
|
-
const columns =
|
|
10746
|
+
const rows = clampMatrixSize2(matrixRows);
|
|
10747
|
+
const columns = clampMatrixSize2(matrixColumns);
|
|
9311
10748
|
insertSelectedEnvironment(rows, columns);
|
|
9312
10749
|
setMatrixMenuOpen(false);
|
|
9313
10750
|
setMatrixHover(null);
|
|
@@ -9317,23 +10754,23 @@ ${arabic || currentMessages.empty}`;
|
|
|
9317
10754
|
}
|
|
9318
10755
|
)
|
|
9319
10756
|
] }),
|
|
9320
|
-
/* @__PURE__ */
|
|
9321
|
-
envPaletteMode === "matrix" ? /* @__PURE__ */
|
|
9322
|
-
envPaletteMode === "array" ? /* @__PURE__ */
|
|
9323
|
-
/* @__PURE__ */
|
|
10757
|
+
/* @__PURE__ */ jsxs2("div", { className: "matrix-edit-actions", "aria-label": messages.editSelectedEnvironment, children: [
|
|
10758
|
+
envPaletteMode === "matrix" ? /* @__PURE__ */ jsx2("button", { type: "button", title: messages.applySelectedMatrixStyle, onMouseDown: (event) => event.preventDefault(), onClick: () => runtimeRef.current?.setMatrixEnvStyle(matrixStyle), children: messages.applyStyle }) : null,
|
|
10759
|
+
envPaletteMode === "array" ? /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
|
10760
|
+
/* @__PURE__ */ jsxs2("label", { children: [
|
|
9324
10761
|
messages.column,
|
|
9325
|
-
/* @__PURE__ */
|
|
10762
|
+
/* @__PURE__ */ jsx2(
|
|
9326
10763
|
"input",
|
|
9327
10764
|
{
|
|
9328
10765
|
type: "number",
|
|
9329
10766
|
min: 1,
|
|
9330
10767
|
max: 12,
|
|
9331
10768
|
value: arrayAlignmentColumn,
|
|
9332
|
-
onChange: (event) => setArrayAlignmentColumn(
|
|
10769
|
+
onChange: (event) => setArrayAlignmentColumn(clampMatrixSize2(Number(event.currentTarget.value) || 1))
|
|
9333
10770
|
}
|
|
9334
10771
|
)
|
|
9335
10772
|
] }),
|
|
9336
|
-
|
|
10773
|
+
ARRAY_ALIGNMENTS2.map((alignment) => /* @__PURE__ */ jsx2(
|
|
9337
10774
|
"button",
|
|
9338
10775
|
{
|
|
9339
10776
|
type: "button",
|
|
@@ -9345,19 +10782,19 @@ ${arabic || currentMessages.empty}`;
|
|
|
9345
10782
|
alignment.id
|
|
9346
10783
|
))
|
|
9347
10784
|
] }) : null,
|
|
9348
|
-
/* @__PURE__ */
|
|
10785
|
+
/* @__PURE__ */ jsxs2("button", { type: "button", title: messages.addRow, onMouseDown: (event) => event.preventDefault(), onClick: () => runtimeRef.current?.addMatrixRow(), children: [
|
|
9349
10786
|
"+",
|
|
9350
10787
|
messages.row
|
|
9351
10788
|
] }),
|
|
9352
|
-
/* @__PURE__ */
|
|
10789
|
+
/* @__PURE__ */ jsxs2("button", { type: "button", title: messages.removeRow, onMouseDown: (event) => event.preventDefault(), onClick: () => runtimeRef.current?.removeMatrixRow(), children: [
|
|
9353
10790
|
"-",
|
|
9354
10791
|
messages.row
|
|
9355
10792
|
] }),
|
|
9356
|
-
/* @__PURE__ */
|
|
10793
|
+
/* @__PURE__ */ jsxs2("button", { type: "button", title: messages.addColumn, onMouseDown: (event) => event.preventDefault(), onClick: () => runtimeRef.current?.addMatrixColumn(), children: [
|
|
9357
10794
|
"+",
|
|
9358
10795
|
messages.column
|
|
9359
10796
|
] }),
|
|
9360
|
-
/* @__PURE__ */
|
|
10797
|
+
/* @__PURE__ */ jsxs2("button", { type: "button", title: messages.removeColumn, onMouseDown: (event) => event.preventDefault(), onClick: () => runtimeRef.current?.removeMatrixColumn(), children: [
|
|
9361
10798
|
"-",
|
|
9362
10799
|
messages.column
|
|
9363
10800
|
] })
|
|
@@ -9366,7 +10803,7 @@ ${arabic || currentMessages.empty}`;
|
|
|
9366
10803
|
]
|
|
9367
10804
|
}
|
|
9368
10805
|
) }),
|
|
9369
|
-
/* @__PURE__ */
|
|
10806
|
+
/* @__PURE__ */ jsx2("div", { className: "toolbar-group toolbar-settings", role: "group", "aria-label": messages.spaces, children: /* @__PURE__ */ jsxs2(
|
|
9370
10807
|
"div",
|
|
9371
10808
|
{
|
|
9372
10809
|
className: `spacing-command-menu spacing-command-menu--${activeEditorSide}`,
|
|
@@ -9377,27 +10814,27 @@ ${arabic || currentMessages.empty}`;
|
|
|
9377
10814
|
}
|
|
9378
10815
|
},
|
|
9379
10816
|
children: [
|
|
9380
|
-
/* @__PURE__ */
|
|
10817
|
+
/* @__PURE__ */ jsx2(
|
|
9381
10818
|
"button",
|
|
9382
10819
|
{
|
|
9383
10820
|
className: "icon-btn spacing-command-btn",
|
|
9384
10821
|
type: "button",
|
|
9385
10822
|
title: messages.insertSpace,
|
|
9386
10823
|
"aria-label": messages.insertSpace,
|
|
9387
|
-
"aria-haspopup": "
|
|
10824
|
+
"aria-haspopup": "menu",
|
|
9388
10825
|
"aria-expanded": spacingMenuOpen,
|
|
9389
10826
|
onClick: () => setSpacingMenuOpen((open) => !open),
|
|
9390
|
-
children: /* @__PURE__ */
|
|
9391
|
-
/* @__PURE__ */
|
|
9392
|
-
/* @__PURE__ */
|
|
10827
|
+
children: /* @__PURE__ */ jsxs2("span", { className: "spacing-command-glyph spacing-command-glyph--positive spacing-command-glyph--level-2", "aria-hidden": "true", children: [
|
|
10828
|
+
/* @__PURE__ */ jsx2("span", { className: "spacing-command-glyph__bar" }),
|
|
10829
|
+
/* @__PURE__ */ jsx2("span", { className: "spacing-command-glyph__arrow", children: activeEditorSide === "arabic" ? "\u2190" : "\u2192" })
|
|
9393
10830
|
] })
|
|
9394
10831
|
}
|
|
9395
10832
|
),
|
|
9396
|
-
/* @__PURE__ */
|
|
10833
|
+
/* @__PURE__ */ jsx2("div", { className: "spacing-command-options", role: "menu", "aria-label": messages.insertSpace, hidden: !spacingMenuOpen, children: SPACING_COMMANDS2.map((command) => /* @__PURE__ */ jsxs2(
|
|
9397
10834
|
"button",
|
|
9398
10835
|
{
|
|
9399
10836
|
type: "button",
|
|
9400
|
-
role: "
|
|
10837
|
+
role: "menuitem",
|
|
9401
10838
|
className: `spacing-command-option spacing-command-option--${command.spacing.direction}`,
|
|
9402
10839
|
title: atomicCommandTitle(command, uiLocale),
|
|
9403
10840
|
onMouseDown: (event) => event.preventDefault(),
|
|
@@ -9407,12 +10844,12 @@ ${arabic || currentMessages.empty}`;
|
|
|
9407
10844
|
focusSurface();
|
|
9408
10845
|
},
|
|
9409
10846
|
children: [
|
|
9410
|
-
/* @__PURE__ */
|
|
9411
|
-
command.spacing.direction === "negative" ? /* @__PURE__ */
|
|
9412
|
-
/* @__PURE__ */
|
|
9413
|
-
command.spacing.direction === "positive" ? /* @__PURE__ */
|
|
10847
|
+
/* @__PURE__ */ jsxs2("span", { className: `spacing-command-glyph spacing-command-glyph--${command.spacing.direction} spacing-command-glyph--level-${String(command.spacing.level)}`, "aria-hidden": "true", children: [
|
|
10848
|
+
command.spacing.direction === "negative" ? /* @__PURE__ */ jsx2("span", { className: "spacing-command-glyph__arrow", children: spacingArrow2(command, activeEditorSide) }) : null,
|
|
10849
|
+
/* @__PURE__ */ jsx2("span", { className: "spacing-command-glyph__bar" }),
|
|
10850
|
+
command.spacing.direction === "positive" ? /* @__PURE__ */ jsx2("span", { className: "spacing-command-glyph__arrow", children: spacingArrow2(command, activeEditorSide) }) : null
|
|
9414
10851
|
] }),
|
|
9415
|
-
/* @__PURE__ */
|
|
10852
|
+
/* @__PURE__ */ jsx2("span", { className: "spacing-command-option__name", children: atomicCommandTitle(command, uiLocale) })
|
|
9416
10853
|
]
|
|
9417
10854
|
},
|
|
9418
10855
|
command.id
|
|
@@ -9420,8 +10857,8 @@ ${arabic || currentMessages.empty}`;
|
|
|
9420
10857
|
]
|
|
9421
10858
|
}
|
|
9422
10859
|
) }),
|
|
9423
|
-
/* @__PURE__ */
|
|
9424
|
-
/* @__PURE__ */
|
|
10860
|
+
/* @__PURE__ */ jsxs2("div", { className: "toolbar-group toolbar-functions", role: "group", "aria-label": messages.functions, children: [
|
|
10861
|
+
/* @__PURE__ */ jsxs2(
|
|
9425
10862
|
"div",
|
|
9426
10863
|
{
|
|
9427
10864
|
className: "function-command-menu",
|
|
@@ -9432,25 +10869,25 @@ ${arabic || currentMessages.empty}`;
|
|
|
9432
10869
|
}
|
|
9433
10870
|
},
|
|
9434
10871
|
children: [
|
|
9435
|
-
/* @__PURE__ */
|
|
10872
|
+
/* @__PURE__ */ jsx2(
|
|
9436
10873
|
"button",
|
|
9437
10874
|
{
|
|
9438
10875
|
className: "icon-btn function-command-btn",
|
|
9439
10876
|
type: "button",
|
|
9440
10877
|
title: messages.insertFunction,
|
|
9441
10878
|
"aria-label": messages.insertFunction,
|
|
9442
|
-
"aria-haspopup": "
|
|
10879
|
+
"aria-haspopup": "menu",
|
|
9443
10880
|
"aria-expanded": functionMenuOpen,
|
|
9444
10881
|
onClick: () => setFunctionMenuOpen((open) => !open),
|
|
9445
|
-
children:
|
|
10882
|
+
children: FUNCTION_COMMANDS2[0]?.arabicLabel ?? "\u062F"
|
|
9446
10883
|
}
|
|
9447
10884
|
),
|
|
9448
|
-
/* @__PURE__ */
|
|
10885
|
+
/* @__PURE__ */ jsx2("div", { className: "function-command-options", role: "menu", "aria-label": messages.insertFunction, hidden: !functionMenuOpen, children: FUNCTION_COMMANDS2.map((command) => /* @__PURE__ */ jsx2(
|
|
9449
10886
|
"button",
|
|
9450
10887
|
{
|
|
9451
10888
|
className: "function-command-option",
|
|
9452
10889
|
type: "button",
|
|
9453
|
-
role: "
|
|
10890
|
+
role: "menuitem",
|
|
9454
10891
|
title: atomicCommandTitle(command, uiLocale),
|
|
9455
10892
|
"aria-label": atomicCommandTitle(command, uiLocale),
|
|
9456
10893
|
onMouseDown: (event) => event.preventDefault(),
|
|
@@ -9466,7 +10903,7 @@ ${arabic || currentMessages.empty}`;
|
|
|
9466
10903
|
]
|
|
9467
10904
|
}
|
|
9468
10905
|
),
|
|
9469
|
-
/* @__PURE__ */
|
|
10906
|
+
/* @__PURE__ */ jsxs2(
|
|
9470
10907
|
"div",
|
|
9471
10908
|
{
|
|
9472
10909
|
className: "function-command-menu function-command-menu--limits-series",
|
|
@@ -9477,25 +10914,25 @@ ${arabic || currentMessages.empty}`;
|
|
|
9477
10914
|
}
|
|
9478
10915
|
},
|
|
9479
10916
|
children: [
|
|
9480
|
-
/* @__PURE__ */
|
|
10917
|
+
/* @__PURE__ */ jsx2(
|
|
9481
10918
|
"button",
|
|
9482
10919
|
{
|
|
9483
10920
|
className: "icon-btn function-command-btn",
|
|
9484
10921
|
type: "button",
|
|
9485
10922
|
title: messages.insertLimitsSeries,
|
|
9486
10923
|
"aria-label": messages.insertLimitsSeries,
|
|
9487
|
-
"aria-haspopup": "
|
|
10924
|
+
"aria-haspopup": "menu",
|
|
9488
10925
|
"aria-expanded": limitsSeriesMenuOpen,
|
|
9489
10926
|
onClick: () => setLimitsSeriesMenuOpen((open) => !open),
|
|
9490
|
-
children:
|
|
10927
|
+
children: LIMITS_SERIES_COMMANDS2[0]?.arabicLabel ?? "\u062D\u062F"
|
|
9491
10928
|
}
|
|
9492
10929
|
),
|
|
9493
|
-
/* @__PURE__ */
|
|
10930
|
+
/* @__PURE__ */ jsx2("div", { className: "function-command-options", role: "menu", "aria-label": messages.insertLimitsSeries, hidden: !limitsSeriesMenuOpen, children: LIMITS_SERIES_COMMANDS2.map((command) => /* @__PURE__ */ jsx2(
|
|
9494
10931
|
"button",
|
|
9495
10932
|
{
|
|
9496
10933
|
className: "function-command-option",
|
|
9497
10934
|
type: "button",
|
|
9498
|
-
role: "
|
|
10935
|
+
role: "menuitem",
|
|
9499
10936
|
title: atomicCommandTitle(command, uiLocale),
|
|
9500
10937
|
"aria-label": atomicCommandTitle(command, uiLocale),
|
|
9501
10938
|
onMouseDown: (event) => event.preventDefault(),
|
|
@@ -9511,7 +10948,7 @@ ${arabic || currentMessages.empty}`;
|
|
|
9511
10948
|
]
|
|
9512
10949
|
}
|
|
9513
10950
|
),
|
|
9514
|
-
/* @__PURE__ */
|
|
10951
|
+
/* @__PURE__ */ jsxs2(
|
|
9515
10952
|
"div",
|
|
9516
10953
|
{
|
|
9517
10954
|
className: "function-command-menu function-command-menu--function2",
|
|
@@ -9522,25 +10959,25 @@ ${arabic || currentMessages.empty}`;
|
|
|
9522
10959
|
}
|
|
9523
10960
|
},
|
|
9524
10961
|
children: [
|
|
9525
|
-
/* @__PURE__ */
|
|
10962
|
+
/* @__PURE__ */ jsx2(
|
|
9526
10963
|
"button",
|
|
9527
10964
|
{
|
|
9528
10965
|
className: "icon-btn function-command-btn",
|
|
9529
10966
|
type: "button",
|
|
9530
10967
|
title: messages.insertAdditionalFunctions,
|
|
9531
10968
|
"aria-label": messages.insertAdditionalFunctions,
|
|
9532
|
-
"aria-haspopup": "
|
|
10969
|
+
"aria-haspopup": "menu",
|
|
9533
10970
|
"aria-expanded": function2MenuOpen,
|
|
9534
10971
|
onClick: () => setFunction2MenuOpen((open) => !open),
|
|
9535
|
-
children:
|
|
10972
|
+
children: FUNCTION2_COMMANDS2[0]?.arabicLabel ?? "\u062F"
|
|
9536
10973
|
}
|
|
9537
10974
|
),
|
|
9538
|
-
/* @__PURE__ */
|
|
10975
|
+
/* @__PURE__ */ jsx2("div", { className: "function-command-options", role: "menu", "aria-label": messages.insertAdditionalFunctions, hidden: !function2MenuOpen, children: FUNCTION2_COMMANDS2.map((command) => /* @__PURE__ */ jsx2(
|
|
9539
10976
|
"button",
|
|
9540
10977
|
{
|
|
9541
10978
|
className: "function-command-option",
|
|
9542
10979
|
type: "button",
|
|
9543
|
-
role: "
|
|
10980
|
+
role: "menuitem",
|
|
9544
10981
|
title: atomicCommandTitle(command, uiLocale),
|
|
9545
10982
|
"aria-label": atomicCommandTitle(command, uiLocale),
|
|
9546
10983
|
onMouseDown: (event) => event.preventDefault(),
|
|
@@ -9556,7 +10993,7 @@ ${arabic || currentMessages.empty}`;
|
|
|
9556
10993
|
]
|
|
9557
10994
|
}
|
|
9558
10995
|
),
|
|
9559
|
-
/* @__PURE__ */
|
|
10996
|
+
/* @__PURE__ */ jsxs2(
|
|
9560
10997
|
"div",
|
|
9561
10998
|
{
|
|
9562
10999
|
className: "function-command-menu function-command-menu--derivative",
|
|
@@ -9567,26 +11004,26 @@ ${arabic || currentMessages.empty}`;
|
|
|
9567
11004
|
}
|
|
9568
11005
|
},
|
|
9569
11006
|
children: [
|
|
9570
|
-
/* @__PURE__ */
|
|
11007
|
+
/* @__PURE__ */ jsx2(
|
|
9571
11008
|
"button",
|
|
9572
11009
|
{
|
|
9573
11010
|
className: "icon-btn function-command-btn",
|
|
9574
11011
|
type: "button",
|
|
9575
11012
|
title: messages.insertDerivative,
|
|
9576
11013
|
"aria-label": messages.insertDerivative,
|
|
9577
|
-
"aria-haspopup": "
|
|
11014
|
+
"aria-haspopup": "menu",
|
|
9578
11015
|
"aria-expanded": derivativeMenuOpen,
|
|
9579
11016
|
onClick: () => setDerivativeMenuOpen((open) => !open),
|
|
9580
|
-
children:
|
|
11017
|
+
children: DERIVATIVE_COMMANDS2[0]?.arabicLabel ?? "\u0621"
|
|
9581
11018
|
}
|
|
9582
11019
|
),
|
|
9583
|
-
/* @__PURE__ */
|
|
9584
|
-
|
|
11020
|
+
/* @__PURE__ */ jsxs2("div", { className: "function-command-options", role: "menu", "aria-label": messages.insertDerivative, hidden: !derivativeMenuOpen, children: [
|
|
11021
|
+
DERIVATIVE_COMMANDS2.map((command) => /* @__PURE__ */ jsx2(
|
|
9585
11022
|
"button",
|
|
9586
11023
|
{
|
|
9587
11024
|
className: "function-command-option",
|
|
9588
11025
|
type: "button",
|
|
9589
|
-
role: "
|
|
11026
|
+
role: "menuitem",
|
|
9590
11027
|
title: atomicCommandTitle(command, uiLocale),
|
|
9591
11028
|
"aria-label": atomicCommandTitle(command, uiLocale),
|
|
9592
11029
|
onMouseDown: (event) => event.preventDefault(),
|
|
@@ -9599,12 +11036,12 @@ ${arabic || currentMessages.empty}`;
|
|
|
9599
11036
|
},
|
|
9600
11037
|
command.id
|
|
9601
11038
|
)),
|
|
9602
|
-
/* @__PURE__ */
|
|
11039
|
+
/* @__PURE__ */ jsx2(
|
|
9603
11040
|
"button",
|
|
9604
11041
|
{
|
|
9605
11042
|
className: "function-command-option",
|
|
9606
11043
|
type: "button",
|
|
9607
|
-
role: "
|
|
11044
|
+
role: "menuitem",
|
|
9608
11045
|
title: messages.insertFirstDerivative,
|
|
9609
11046
|
"aria-label": messages.insertFirstDerivative,
|
|
9610
11047
|
onMouseDown: (event) => event.preventDefault(),
|
|
@@ -9616,12 +11053,12 @@ ${arabic || currentMessages.empty}`;
|
|
|
9616
11053
|
children: "\u0621/\u0633"
|
|
9617
11054
|
}
|
|
9618
11055
|
),
|
|
9619
|
-
/* @__PURE__ */
|
|
11056
|
+
/* @__PURE__ */ jsx2(
|
|
9620
11057
|
"button",
|
|
9621
11058
|
{
|
|
9622
11059
|
className: "function-command-option",
|
|
9623
11060
|
type: "button",
|
|
9624
|
-
role: "
|
|
11061
|
+
role: "menuitem",
|
|
9625
11062
|
title: messages.insertSecondDerivative,
|
|
9626
11063
|
"aria-label": messages.insertSecondDerivative,
|
|
9627
11064
|
onMouseDown: (event) => event.preventDefault(),
|
|
@@ -9637,7 +11074,7 @@ ${arabic || currentMessages.empty}`;
|
|
|
9637
11074
|
]
|
|
9638
11075
|
}
|
|
9639
11076
|
),
|
|
9640
|
-
/* @__PURE__ */
|
|
11077
|
+
/* @__PURE__ */ jsxs2(
|
|
9641
11078
|
"div",
|
|
9642
11079
|
{
|
|
9643
11080
|
className: "function-command-menu function-command-menu--groups",
|
|
@@ -9648,25 +11085,25 @@ ${arabic || currentMessages.empty}`;
|
|
|
9648
11085
|
}
|
|
9649
11086
|
},
|
|
9650
11087
|
children: [
|
|
9651
|
-
/* @__PURE__ */
|
|
11088
|
+
/* @__PURE__ */ jsx2(
|
|
9652
11089
|
"button",
|
|
9653
11090
|
{
|
|
9654
11091
|
className: "icon-btn function-command-btn",
|
|
9655
11092
|
type: "button",
|
|
9656
11093
|
title: messages.insertNumberSets,
|
|
9657
11094
|
"aria-label": messages.insertNumberSets,
|
|
9658
|
-
"aria-haspopup": "
|
|
11095
|
+
"aria-haspopup": "menu",
|
|
9659
11096
|
"aria-expanded": groupMenuOpen,
|
|
9660
11097
|
onClick: () => setGroupMenuOpen((open) => !open),
|
|
9661
|
-
children:
|
|
11098
|
+
children: GROUP_COMMANDS2[0]?.arabicLabel ?? "\u0645"
|
|
9662
11099
|
}
|
|
9663
11100
|
),
|
|
9664
|
-
/* @__PURE__ */
|
|
11101
|
+
/* @__PURE__ */ jsx2("div", { className: "function-command-options", role: "menu", "aria-label": messages.insertNumberSets, hidden: !groupMenuOpen, children: GROUP_COMMANDS2.map((command) => /* @__PURE__ */ jsx2(
|
|
9665
11102
|
"button",
|
|
9666
11103
|
{
|
|
9667
11104
|
className: "function-command-option",
|
|
9668
11105
|
type: "button",
|
|
9669
|
-
role: "
|
|
11106
|
+
role: "menuitem",
|
|
9670
11107
|
title: atomicCommandTitle(command, uiLocale),
|
|
9671
11108
|
"aria-label": atomicCommandTitle(command, uiLocale),
|
|
9672
11109
|
onMouseDown: (event) => event.preventDefault(),
|
|
@@ -9683,8 +11120,8 @@ ${arabic || currentMessages.empty}`;
|
|
|
9683
11120
|
}
|
|
9684
11121
|
)
|
|
9685
11122
|
] }),
|
|
9686
|
-
/* @__PURE__ */
|
|
9687
|
-
/* @__PURE__ */
|
|
11123
|
+
/* @__PURE__ */ jsxs2("div", { className: "toolbar-group toolbar-operators", role: "group", "aria-label": messages.operations, children: [
|
|
11124
|
+
/* @__PURE__ */ jsxs2(
|
|
9688
11125
|
"div",
|
|
9689
11126
|
{
|
|
9690
11127
|
className: "function-command-menu operator-command-menu",
|
|
@@ -9695,25 +11132,25 @@ ${arabic || currentMessages.empty}`;
|
|
|
9695
11132
|
}
|
|
9696
11133
|
},
|
|
9697
11134
|
children: [
|
|
9698
|
-
/* @__PURE__ */
|
|
11135
|
+
/* @__PURE__ */ jsx2(
|
|
9699
11136
|
"button",
|
|
9700
11137
|
{
|
|
9701
11138
|
className: "icon-btn function-command-btn operator-command-btn",
|
|
9702
11139
|
type: "button",
|
|
9703
11140
|
title: messages.insertOperation,
|
|
9704
11141
|
"aria-label": messages.insertOperation,
|
|
9705
|
-
"aria-haspopup": "
|
|
11142
|
+
"aria-haspopup": "menu",
|
|
9706
11143
|
"aria-expanded": operatorMenuOpen,
|
|
9707
11144
|
onClick: () => setOperatorMenuOpen((open) => !open),
|
|
9708
11145
|
children: renderOperatorMenuButtonLabel(OPERATOR_COMMANDS[0], "\u2217")
|
|
9709
11146
|
}
|
|
9710
11147
|
),
|
|
9711
|
-
/* @__PURE__ */
|
|
11148
|
+
/* @__PURE__ */ jsx2("div", { className: "function-command-options operator-command-options", role: "menu", "aria-label": messages.insertOperation, hidden: !operatorMenuOpen, children: OPERATOR_COMMANDS.map((command) => /* @__PURE__ */ jsx2(
|
|
9712
11149
|
"button",
|
|
9713
11150
|
{
|
|
9714
11151
|
className: "function-command-option operator-command-option",
|
|
9715
11152
|
type: "button",
|
|
9716
|
-
role: "
|
|
11153
|
+
role: "menuitem",
|
|
9717
11154
|
title: atomicOperatorCommandTitle(command, uiLocale),
|
|
9718
11155
|
"aria-label": atomicOperatorCommandTitle(command, uiLocale),
|
|
9719
11156
|
onMouseDown: (event) => event.preventDefault(),
|
|
@@ -9722,14 +11159,14 @@ ${arabic || currentMessages.empty}`;
|
|
|
9722
11159
|
setOperatorMenuOpen(false);
|
|
9723
11160
|
focusSurface();
|
|
9724
11161
|
},
|
|
9725
|
-
children: /* @__PURE__ */
|
|
11162
|
+
children: /* @__PURE__ */ jsx2("span", { className: shouldMirrorOperatorDisplay(command) ? "operator-command-label operator-command-label--mirror" : "operator-command-label", children: renderOperatorCommandLabel(command) })
|
|
9726
11163
|
},
|
|
9727
11164
|
command.id
|
|
9728
11165
|
)) })
|
|
9729
11166
|
]
|
|
9730
11167
|
}
|
|
9731
11168
|
),
|
|
9732
|
-
/* @__PURE__ */
|
|
11169
|
+
/* @__PURE__ */ jsxs2(
|
|
9733
11170
|
"div",
|
|
9734
11171
|
{
|
|
9735
11172
|
className: "function-command-menu operator-command-menu",
|
|
@@ -9740,25 +11177,25 @@ ${arabic || currentMessages.empty}`;
|
|
|
9740
11177
|
}
|
|
9741
11178
|
},
|
|
9742
11179
|
children: [
|
|
9743
|
-
/* @__PURE__ */
|
|
11180
|
+
/* @__PURE__ */ jsx2(
|
|
9744
11181
|
"button",
|
|
9745
11182
|
{
|
|
9746
11183
|
className: "icon-btn function-command-btn operator-command-btn",
|
|
9747
11184
|
type: "button",
|
|
9748
11185
|
title: messages.insertRelationsSets,
|
|
9749
11186
|
"aria-label": messages.insertRelationsSets,
|
|
9750
|
-
"aria-haspopup": "
|
|
11187
|
+
"aria-haspopup": "menu",
|
|
9751
11188
|
"aria-expanded": operator2MenuOpen,
|
|
9752
11189
|
onClick: () => setOperator2MenuOpen((open) => !open),
|
|
9753
11190
|
children: "\u2229"
|
|
9754
11191
|
}
|
|
9755
11192
|
),
|
|
9756
|
-
/* @__PURE__ */
|
|
11193
|
+
/* @__PURE__ */ jsx2("div", { className: "function-command-options operator-command-options", role: "menu", "aria-label": messages.insertRelationsSets, hidden: !operator2MenuOpen, children: OPERATOR2_COMMANDS.map((command) => /* @__PURE__ */ jsx2(
|
|
9757
11194
|
"button",
|
|
9758
11195
|
{
|
|
9759
11196
|
className: "function-command-option operator-command-option",
|
|
9760
11197
|
type: "button",
|
|
9761
|
-
role: "
|
|
11198
|
+
role: "menuitem",
|
|
9762
11199
|
title: atomicOperatorCommandTitle(command, uiLocale),
|
|
9763
11200
|
"aria-label": atomicOperatorCommandTitle(command, uiLocale),
|
|
9764
11201
|
onMouseDown: (event) => event.preventDefault(),
|
|
@@ -9767,14 +11204,14 @@ ${arabic || currentMessages.empty}`;
|
|
|
9767
11204
|
setOperator2MenuOpen(false);
|
|
9768
11205
|
focusSurface();
|
|
9769
11206
|
},
|
|
9770
|
-
children: /* @__PURE__ */
|
|
11207
|
+
children: /* @__PURE__ */ jsx2("span", { className: shouldMirrorOperatorDisplay(command) ? "operator-command-label operator-command-label--mirror" : "operator-command-label", children: renderOperatorCommandLabel(command) })
|
|
9771
11208
|
},
|
|
9772
11209
|
command.id
|
|
9773
11210
|
)) })
|
|
9774
11211
|
]
|
|
9775
11212
|
}
|
|
9776
11213
|
),
|
|
9777
|
-
/* @__PURE__ */
|
|
11214
|
+
/* @__PURE__ */ jsxs2(
|
|
9778
11215
|
"div",
|
|
9779
11216
|
{
|
|
9780
11217
|
className: "function-command-menu operator-command-menu",
|
|
@@ -9785,25 +11222,25 @@ ${arabic || currentMessages.empty}`;
|
|
|
9785
11222
|
}
|
|
9786
11223
|
},
|
|
9787
11224
|
children: [
|
|
9788
|
-
/* @__PURE__ */
|
|
11225
|
+
/* @__PURE__ */ jsx2(
|
|
9789
11226
|
"button",
|
|
9790
11227
|
{
|
|
9791
11228
|
className: "icon-btn function-command-btn operator-command-btn",
|
|
9792
11229
|
type: "button",
|
|
9793
11230
|
title: messages.insertArrows,
|
|
9794
11231
|
"aria-label": messages.insertArrows,
|
|
9795
|
-
"aria-haspopup": "
|
|
11232
|
+
"aria-haspopup": "menu",
|
|
9796
11233
|
"aria-expanded": operator3MenuOpen,
|
|
9797
11234
|
onClick: () => setOperator3MenuOpen((open) => !open),
|
|
9798
11235
|
children: renderOperatorMenuButtonLabel(OPERATOR3_COMMANDS[0], "\u21D2")
|
|
9799
11236
|
}
|
|
9800
11237
|
),
|
|
9801
|
-
/* @__PURE__ */
|
|
11238
|
+
/* @__PURE__ */ jsx2("div", { className: "function-command-options operator-command-options", role: "menu", "aria-label": messages.insertArrows, hidden: !operator3MenuOpen, children: OPERATOR3_COMMANDS.map((command) => /* @__PURE__ */ jsx2(
|
|
9802
11239
|
"button",
|
|
9803
11240
|
{
|
|
9804
11241
|
className: "function-command-option operator-command-option",
|
|
9805
11242
|
type: "button",
|
|
9806
|
-
role: "
|
|
11243
|
+
role: "menuitem",
|
|
9807
11244
|
title: atomicOperatorCommandTitle(command, uiLocale),
|
|
9808
11245
|
"aria-label": atomicOperatorCommandTitle(command, uiLocale),
|
|
9809
11246
|
onMouseDown: (event) => event.preventDefault(),
|
|
@@ -9812,14 +11249,14 @@ ${arabic || currentMessages.empty}`;
|
|
|
9812
11249
|
setOperator3MenuOpen(false);
|
|
9813
11250
|
focusSurface();
|
|
9814
11251
|
},
|
|
9815
|
-
children: /* @__PURE__ */
|
|
11252
|
+
children: /* @__PURE__ */ jsx2("span", { className: shouldMirrorOperatorDisplay(command) ? "operator-command-label operator-command-label--mirror" : "operator-command-label", children: renderOperatorCommandLabel(command) })
|
|
9816
11253
|
},
|
|
9817
11254
|
command.id
|
|
9818
11255
|
)) })
|
|
9819
11256
|
]
|
|
9820
11257
|
}
|
|
9821
11258
|
),
|
|
9822
|
-
/* @__PURE__ */
|
|
11259
|
+
/* @__PURE__ */ jsxs2(
|
|
9823
11260
|
"div",
|
|
9824
11261
|
{
|
|
9825
11262
|
className: "function-command-menu operator-command-menu",
|
|
@@ -9830,25 +11267,25 @@ ${arabic || currentMessages.empty}`;
|
|
|
9830
11267
|
}
|
|
9831
11268
|
},
|
|
9832
11269
|
children: [
|
|
9833
|
-
/* @__PURE__ */
|
|
11270
|
+
/* @__PURE__ */ jsx2(
|
|
9834
11271
|
"button",
|
|
9835
11272
|
{
|
|
9836
11273
|
className: "icon-btn function-command-btn operator-command-btn",
|
|
9837
11274
|
type: "button",
|
|
9838
11275
|
title: messages.insertDots,
|
|
9839
11276
|
"aria-label": messages.insertDots,
|
|
9840
|
-
"aria-haspopup": "
|
|
11277
|
+
"aria-haspopup": "menu",
|
|
9841
11278
|
"aria-expanded": dotMenuOpen,
|
|
9842
11279
|
onClick: () => setDotMenuOpen((open) => !open),
|
|
9843
11280
|
children: renderOperatorMenuButtonLabel(DOT_COMMANDS[0], "\u2026")
|
|
9844
11281
|
}
|
|
9845
11282
|
),
|
|
9846
|
-
/* @__PURE__ */
|
|
11283
|
+
/* @__PURE__ */ jsx2("div", { className: "function-command-options operator-command-options", role: "menu", "aria-label": messages.insertDots, hidden: !dotMenuOpen, children: DOT_COMMANDS.map((command) => /* @__PURE__ */ jsx2(
|
|
9847
11284
|
"button",
|
|
9848
11285
|
{
|
|
9849
11286
|
className: "function-command-option operator-command-option",
|
|
9850
11287
|
type: "button",
|
|
9851
|
-
role: "
|
|
11288
|
+
role: "menuitem",
|
|
9852
11289
|
title: atomicOperatorCommandTitle(command, uiLocale),
|
|
9853
11290
|
"aria-label": atomicOperatorCommandTitle(command, uiLocale),
|
|
9854
11291
|
onMouseDown: (event) => event.preventDefault(),
|
|
@@ -9857,14 +11294,14 @@ ${arabic || currentMessages.empty}`;
|
|
|
9857
11294
|
setDotMenuOpen(false);
|
|
9858
11295
|
focusSurface();
|
|
9859
11296
|
},
|
|
9860
|
-
children: /* @__PURE__ */
|
|
11297
|
+
children: /* @__PURE__ */ jsx2("span", { className: shouldMirrorOperatorDisplay(command) ? "operator-command-label operator-command-label--mirror" : "operator-command-label", children: renderOperatorCommandLabel(command) })
|
|
9861
11298
|
},
|
|
9862
11299
|
command.id
|
|
9863
11300
|
)) })
|
|
9864
11301
|
]
|
|
9865
11302
|
}
|
|
9866
11303
|
),
|
|
9867
|
-
/* @__PURE__ */
|
|
11304
|
+
/* @__PURE__ */ jsxs2(
|
|
9868
11305
|
"div",
|
|
9869
11306
|
{
|
|
9870
11307
|
className: "function-command-menu operator-command-menu",
|
|
@@ -9875,25 +11312,25 @@ ${arabic || currentMessages.empty}`;
|
|
|
9875
11312
|
}
|
|
9876
11313
|
},
|
|
9877
11314
|
children: [
|
|
9878
|
-
/* @__PURE__ */
|
|
11315
|
+
/* @__PURE__ */ jsx2(
|
|
9879
11316
|
"button",
|
|
9880
11317
|
{
|
|
9881
11318
|
className: "icon-btn function-command-btn operator-command-btn",
|
|
9882
11319
|
type: "button",
|
|
9883
11320
|
title: messages.insertIntegrals,
|
|
9884
11321
|
"aria-label": messages.insertIntegrals,
|
|
9885
|
-
"aria-haspopup": "
|
|
11322
|
+
"aria-haspopup": "menu",
|
|
9886
11323
|
"aria-expanded": integralMenuOpen,
|
|
9887
11324
|
onClick: () => setIntegralMenuOpen((open) => !open),
|
|
9888
11325
|
children: renderOperatorMenuButtonLabel(INTEGRAL_COMMANDS[0], "\u222B")
|
|
9889
11326
|
}
|
|
9890
11327
|
),
|
|
9891
|
-
/* @__PURE__ */
|
|
11328
|
+
/* @__PURE__ */ jsx2("div", { className: "function-command-options operator-command-options", role: "menu", "aria-label": messages.insertIntegrals, hidden: !integralMenuOpen, children: INTEGRAL_COMMANDS.map((command) => /* @__PURE__ */ jsx2(
|
|
9892
11329
|
"button",
|
|
9893
11330
|
{
|
|
9894
11331
|
className: "function-command-option operator-command-option",
|
|
9895
11332
|
type: "button",
|
|
9896
|
-
role: "
|
|
11333
|
+
role: "menuitem",
|
|
9897
11334
|
title: atomicOperatorCommandTitle(command, uiLocale),
|
|
9898
11335
|
"aria-label": atomicOperatorCommandTitle(command, uiLocale),
|
|
9899
11336
|
onMouseDown: (event) => event.preventDefault(),
|
|
@@ -9902,7 +11339,7 @@ ${arabic || currentMessages.empty}`;
|
|
|
9902
11339
|
setIntegralMenuOpen(false);
|
|
9903
11340
|
focusSurface();
|
|
9904
11341
|
},
|
|
9905
|
-
children: /* @__PURE__ */
|
|
11342
|
+
children: /* @__PURE__ */ jsx2("span", { className: shouldMirrorOperatorDisplay(command) ? "operator-command-label operator-command-label--mirror" : "operator-command-label", children: renderOperatorCommandLabel(command) })
|
|
9906
11343
|
},
|
|
9907
11344
|
command.id
|
|
9908
11345
|
)) })
|
|
@@ -9910,28 +11347,28 @@ ${arabic || currentMessages.empty}`;
|
|
|
9910
11347
|
}
|
|
9911
11348
|
)
|
|
9912
11349
|
] }),
|
|
9913
|
-
/* @__PURE__ */
|
|
9914
|
-
/* @__PURE__ */
|
|
9915
|
-
/* @__PURE__ */
|
|
9916
|
-
/* @__PURE__ */
|
|
11350
|
+
/* @__PURE__ */ jsxs2("div", { className: "toolbar-group toolbar-scripts", role: "group", "aria-label": messages.scripts, children: [
|
|
11351
|
+
/* @__PURE__ */ jsx2("button", { className: "icon-btn script-icon-btn", type: "button", title: messages.addSuperscript, "aria-label": messages.addSuperscript, onClick: () => runtimeRef.current?.addSup(), children: /* @__PURE__ */ jsxs2("span", { className: "toolbar-script-icon toolbar-script-icon--sup", "aria-hidden": "true", children: [
|
|
11352
|
+
/* @__PURE__ */ jsx2("span", { children: "\u0646" }),
|
|
11353
|
+
/* @__PURE__ */ jsx2("span", { children: "\u0633" })
|
|
9917
11354
|
] }) }),
|
|
9918
|
-
/* @__PURE__ */
|
|
9919
|
-
/* @__PURE__ */
|
|
9920
|
-
/* @__PURE__ */
|
|
11355
|
+
/* @__PURE__ */ jsx2("button", { className: "icon-btn script-icon-btn", type: "button", title: messages.addSubscript, "aria-label": messages.addSubscript, onClick: () => runtimeRef.current?.addSub(), children: /* @__PURE__ */ jsxs2("span", { className: "toolbar-script-icon toolbar-script-icon--sub", "aria-hidden": "true", children: [
|
|
11356
|
+
/* @__PURE__ */ jsx2("span", { children: "\u0646" }),
|
|
11357
|
+
/* @__PURE__ */ jsx2("span", { children: "\u0633" })
|
|
9921
11358
|
] }) }),
|
|
9922
|
-
/* @__PURE__ */
|
|
9923
|
-
/* @__PURE__ */
|
|
9924
|
-
/* @__PURE__ */
|
|
11359
|
+
/* @__PURE__ */ jsx2("button", { className: "icon-btn script-icon-btn remove-script-btn", type: "button", title: messages.removeSuperscript, "aria-label": messages.removeSuperscript, onClick: () => runtimeRef.current?.removeSup(), children: /* @__PURE__ */ jsxs2("span", { className: "toolbar-remove-script-icon toolbar-remove-script-icon--sup", "aria-hidden": "true", children: [
|
|
11360
|
+
/* @__PURE__ */ jsx2("span", { children: "\u0646" }),
|
|
11361
|
+
/* @__PURE__ */ jsx2("span", { children: "\xD7" })
|
|
9925
11362
|
] }) }),
|
|
9926
|
-
/* @__PURE__ */
|
|
9927
|
-
/* @__PURE__ */
|
|
9928
|
-
/* @__PURE__ */
|
|
11363
|
+
/* @__PURE__ */ jsx2("button", { className: "icon-btn script-icon-btn remove-script-btn", type: "button", title: messages.removeSubscript, "aria-label": messages.removeSubscript, onClick: () => runtimeRef.current?.removeSub(), children: /* @__PURE__ */ jsxs2("span", { className: "toolbar-remove-script-icon toolbar-remove-script-icon--sub", "aria-hidden": "true", children: [
|
|
11364
|
+
/* @__PURE__ */ jsx2("span", { children: "\u0646" }),
|
|
11365
|
+
/* @__PURE__ */ jsx2("span", { children: "\xD7" })
|
|
9929
11366
|
] }) })
|
|
9930
11367
|
] }),
|
|
9931
|
-
/* @__PURE__ */
|
|
9932
|
-
/* @__PURE__ */
|
|
9933
|
-
/* @__PURE__ */
|
|
9934
|
-
/* @__PURE__ */
|
|
11368
|
+
/* @__PURE__ */ jsxs2("div", { className: "toolbar-group toolbar-settings", role: "group", "aria-label": messages.inputStyles, children: [
|
|
11369
|
+
/* @__PURE__ */ jsx2("button", { className: "icon-btn delete-node-btn", type: "button", title: messages.deleteSelectedStructure, "aria-label": messages.deleteSelectedStructure, onClick: () => runtimeRef.current?.deleteStructure(), children: "\xD7" }),
|
|
11370
|
+
/* @__PURE__ */ jsx2("button", { ref: splitTypingBtnRef, id: "toggle-split-leaf-typing", className: "icon-btn ligature-btn", type: "button", title: messages.toggleLetterMerging, "aria-label": messages.toggleLetterMerging, onClick: () => runtimeRef.current?.toggleSplitLeafTyping(), children: "\u0633\u0635\u0639" }),
|
|
11371
|
+
/* @__PURE__ */ jsxs2(
|
|
9935
11372
|
"div",
|
|
9936
11373
|
{
|
|
9937
11374
|
className: "character-font-menu",
|
|
@@ -9942,14 +11379,14 @@ ${arabic || currentMessages.empty}`;
|
|
|
9942
11379
|
}
|
|
9943
11380
|
},
|
|
9944
11381
|
children: [
|
|
9945
|
-
/* @__PURE__ */
|
|
11382
|
+
/* @__PURE__ */ jsx2(
|
|
9946
11383
|
"button",
|
|
9947
11384
|
{
|
|
9948
11385
|
ref: characterFontBtnRef,
|
|
9949
11386
|
id: "select-character-font",
|
|
9950
11387
|
className: `icon-btn font-mode-btn font-mode-btn--${selectedCharacterFont}`,
|
|
9951
11388
|
type: "button",
|
|
9952
|
-
title:
|
|
11389
|
+
title: characterFontTitle2(selectedCharacterFont, messages),
|
|
9953
11390
|
"aria-label": messages.chooseWritingFont,
|
|
9954
11391
|
"aria-haspopup": "listbox",
|
|
9955
11392
|
"aria-expanded": characterFontMenuOpen,
|
|
@@ -9957,14 +11394,14 @@ ${arabic || currentMessages.empty}`;
|
|
|
9957
11394
|
children: characterFontOption(selectedCharacterFont).label
|
|
9958
11395
|
}
|
|
9959
11396
|
),
|
|
9960
|
-
/* @__PURE__ */
|
|
11397
|
+
/* @__PURE__ */ jsx2("div", { className: "character-font-options", role: "listbox", "aria-label": messages.chooseWritingFont, hidden: !characterFontMenuOpen, children: CHARACTER_FONT_OPTIONS.map((option) => /* @__PURE__ */ jsx2(
|
|
9961
11398
|
"button",
|
|
9962
11399
|
{
|
|
9963
11400
|
type: "button",
|
|
9964
11401
|
role: "option",
|
|
9965
11402
|
"aria-selected": selectedCharacterFont === option.id,
|
|
9966
11403
|
className: `character-font-option character-font-option--${option.id}`,
|
|
9967
|
-
title:
|
|
11404
|
+
title: characterFontTitle2(option.id, messages),
|
|
9968
11405
|
onMouseDown: (event) => event.preventDefault(),
|
|
9969
11406
|
onClick: () => {
|
|
9970
11407
|
runtimeRef.current?.setCurrentCharacterFont(option.id);
|
|
@@ -9979,7 +11416,7 @@ ${arabic || currentMessages.empty}`;
|
|
|
9979
11416
|
]
|
|
9980
11417
|
}
|
|
9981
11418
|
),
|
|
9982
|
-
/* @__PURE__ */
|
|
11419
|
+
/* @__PURE__ */ jsxs2(
|
|
9983
11420
|
"div",
|
|
9984
11421
|
{
|
|
9985
11422
|
className: "digit-form-menu",
|
|
@@ -9990,7 +11427,7 @@ ${arabic || currentMessages.empty}`;
|
|
|
9990
11427
|
}
|
|
9991
11428
|
},
|
|
9992
11429
|
children: [
|
|
9993
|
-
/* @__PURE__ */
|
|
11430
|
+
/* @__PURE__ */ jsx2(
|
|
9994
11431
|
"button",
|
|
9995
11432
|
{
|
|
9996
11433
|
ref: digitFormBtnRef,
|
|
@@ -10005,7 +11442,7 @@ ${arabic || currentMessages.empty}`;
|
|
|
10005
11442
|
children: digitFormLabel(selectedDigitForm2)
|
|
10006
11443
|
}
|
|
10007
11444
|
),
|
|
10008
|
-
/* @__PURE__ */
|
|
11445
|
+
/* @__PURE__ */ jsx2("div", { className: "digit-form-options", role: "listbox", "aria-label": messages.chooseDigitForm, hidden: !digitMenuOpen, children: DIGIT_FORM_OPTIONS.map((option) => /* @__PURE__ */ jsx2(
|
|
10009
11446
|
"button",
|
|
10010
11447
|
{
|
|
10011
11448
|
type: "button",
|
|
@@ -10029,7 +11466,7 @@ ${arabic || currentMessages.empty}`;
|
|
|
10029
11466
|
)
|
|
10030
11467
|
] })
|
|
10031
11468
|
] }),
|
|
10032
|
-
/* @__PURE__ */
|
|
11469
|
+
/* @__PURE__ */ jsx2(
|
|
10033
11470
|
"div",
|
|
10034
11471
|
{
|
|
10035
11472
|
ref: surfaceRef,
|
|
@@ -10039,7 +11476,7 @@ ${arabic || currentMessages.empty}`;
|
|
|
10039
11476
|
"aria-label": messages.equationEditor
|
|
10040
11477
|
}
|
|
10041
11478
|
),
|
|
10042
|
-
/* @__PURE__ */
|
|
11479
|
+
/* @__PURE__ */ jsx2(
|
|
10043
11480
|
"textarea",
|
|
10044
11481
|
{
|
|
10045
11482
|
ref: inputRef,
|
|
@@ -10053,20 +11490,31 @@ ${arabic || currentMessages.empty}`;
|
|
|
10053
11490
|
tabIndex: -1
|
|
10054
11491
|
}
|
|
10055
11492
|
),
|
|
10056
|
-
/* @__PURE__ */
|
|
11493
|
+
/* @__PURE__ */ jsx2("div", { ref: renderErrorRef, className: "error", hidden: true }),
|
|
11494
|
+
/* @__PURE__ */ jsx2(
|
|
11495
|
+
"button",
|
|
11496
|
+
{
|
|
11497
|
+
type: "button",
|
|
11498
|
+
className: "butex-widget__mobile-preview-toggle",
|
|
11499
|
+
"aria-controls": previewPanelId,
|
|
11500
|
+
"aria-expanded": compactPreviewOpen,
|
|
11501
|
+
onClick: () => setCompactPreviewOpen((open) => !open),
|
|
11502
|
+
children: compactPreviewOpen ? messages.hidePreview : messages.showPreview
|
|
11503
|
+
}
|
|
11504
|
+
)
|
|
10057
11505
|
] }),
|
|
10058
|
-
/* @__PURE__ */
|
|
10059
|
-
debugEnabled ? /* @__PURE__ */
|
|
10060
|
-
/* @__PURE__ */
|
|
10061
|
-
/* @__PURE__ */
|
|
10062
|
-
/* @__PURE__ */
|
|
10063
|
-
/* @__PURE__ */
|
|
11506
|
+
/* @__PURE__ */ jsx2("section", { id: previewPanelId, className: "panel panel-preview", "aria-label": messages.renderPreview, children: /* @__PURE__ */ jsx2("div", { ref: mathOutputRef, className: "preview-box" }) }),
|
|
11507
|
+
debugEnabled ? /* @__PURE__ */ jsxs2("section", { className: "panel", children: [
|
|
11508
|
+
/* @__PURE__ */ jsxs2("div", { className: "dev-strip", children: [
|
|
11509
|
+
/* @__PURE__ */ jsx2("span", { className: "dev-badge", children: messages.development }),
|
|
11510
|
+
/* @__PURE__ */ jsx2("div", { ref: latexLinesRef, className: "ascii" }),
|
|
11511
|
+
/* @__PURE__ */ jsx2("div", { ref: passivePreviewRef, className: "passive-preview-text" })
|
|
10064
11512
|
] }),
|
|
10065
|
-
/* @__PURE__ */
|
|
10066
|
-
/* @__PURE__ */
|
|
10067
|
-
/* @__PURE__ */
|
|
10068
|
-
/* @__PURE__ */
|
|
10069
|
-
/* @__PURE__ */
|
|
11513
|
+
/* @__PURE__ */ jsxs2("div", { style: { marginTop: 12 }, children: [
|
|
11514
|
+
/* @__PURE__ */ jsxs2("div", { className: "debug-head", children: [
|
|
11515
|
+
/* @__PURE__ */ jsx2("button", { type: "button", onClick: () => void copyDebugText(currentMathObjectJsonText()), children: "Copy MathObject JSON" }),
|
|
11516
|
+
/* @__PURE__ */ jsx2("button", { type: "button", "aria-expanded": debugImportOpen, onClick: openDebugMathObjectImport, children: "Import MathObject JSON" }),
|
|
11517
|
+
/* @__PURE__ */ jsx2(
|
|
10070
11518
|
"button",
|
|
10071
11519
|
{
|
|
10072
11520
|
type: "button",
|
|
@@ -10086,7 +11534,7 @@ ${arabic || currentMessages.empty}`;
|
|
|
10086
11534
|
children: debugBodyHidden ? messages.showDebugLog : messages.hideDebugLog
|
|
10087
11535
|
}
|
|
10088
11536
|
),
|
|
10089
|
-
/* @__PURE__ */
|
|
11537
|
+
/* @__PURE__ */ jsx2(
|
|
10090
11538
|
"button",
|
|
10091
11539
|
{
|
|
10092
11540
|
type: "button",
|
|
@@ -10101,8 +11549,8 @@ ${arabic || currentMessages.empty}`;
|
|
|
10101
11549
|
}
|
|
10102
11550
|
)
|
|
10103
11551
|
] }),
|
|
10104
|
-
debugImportOpen ? /* @__PURE__ */
|
|
10105
|
-
/* @__PURE__ */
|
|
11552
|
+
debugImportOpen ? /* @__PURE__ */ jsxs2("div", { className: "debug-json-import", children: [
|
|
11553
|
+
/* @__PURE__ */ jsx2(
|
|
10106
11554
|
"textarea",
|
|
10107
11555
|
{
|
|
10108
11556
|
value: debugImportText,
|
|
@@ -10114,9 +11562,9 @@ ${arabic || currentMessages.empty}`;
|
|
|
10114
11562
|
}
|
|
10115
11563
|
}
|
|
10116
11564
|
),
|
|
10117
|
-
/* @__PURE__ */
|
|
10118
|
-
/* @__PURE__ */
|
|
10119
|
-
/* @__PURE__ */
|
|
11565
|
+
/* @__PURE__ */ jsxs2("div", { className: "debug-head", children: [
|
|
11566
|
+
/* @__PURE__ */ jsx2("button", { type: "button", onClick: applyDebugMathObjectImport, children: "Apply" }),
|
|
11567
|
+
/* @__PURE__ */ jsx2(
|
|
10120
11568
|
"button",
|
|
10121
11569
|
{
|
|
10122
11570
|
type: "button",
|
|
@@ -10128,9 +11576,9 @@ ${arabic || currentMessages.empty}`;
|
|
|
10128
11576
|
}
|
|
10129
11577
|
)
|
|
10130
11578
|
] }),
|
|
10131
|
-
debugImportError ? /* @__PURE__ */
|
|
11579
|
+
debugImportError ? /* @__PURE__ */ jsx2("p", { className: "debug-json-error", children: debugImportError }) : null
|
|
10132
11580
|
] }) : null,
|
|
10133
|
-
/* @__PURE__ */
|
|
11581
|
+
/* @__PURE__ */ jsx2("div", { ref: debugLogRef, className: "debug-log" })
|
|
10134
11582
|
] })
|
|
10135
11583
|
] }) : null
|
|
10136
11584
|
] })
|