digi-mathchem-editor 1.0.29 → 1.0.31

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.
@@ -24,6 +24,24 @@ const J = {
24
24
  },
25
25
  notni: {
26
26
  def: "\\mathrel{\\char`∌}"
27
+ },
28
+ cmeNotEqual: {
29
+ def: "\\class{cme-not-equal}{=}"
30
+ },
31
+ cmeNotApprox: {
32
+ def: "\\class{cme-not-approx}{\\approx}"
33
+ },
34
+ cmeNotEquiv: {
35
+ def: "\\class{cme-not-equiv}{\\equiv}"
36
+ },
37
+ cmeNotSim: {
38
+ def: "\\class{cme-not-sim}{\\sim}"
39
+ },
40
+ napprox: {
41
+ def: "\\class{cme-not-approx}{\\approx}"
42
+ },
43
+ nequiv: {
44
+ def: "\\class{cme-not-equiv}{\\equiv}"
27
45
  }
28
46
  };
29
47
  typeof window < "u" && (window.__cme_macros = {
@@ -210,7 +228,7 @@ const z = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAYAAAD0eNT6AAA
210
228
  <rect x="9" y="7" width="6" height="10" rx="1" stroke="#2E7D32" stroke-width="2" fill="none" />
211
229
  <line x1="9" y1="21" x2="15" y2="3" stroke="#666" stroke-width="2" stroke-linecap="round" />
212
230
  </svg>`,
213
- insert: "\\cancel{#?}",
231
+ insert: "\\class{cme-cancel-strike}{#?}",
214
232
  isWidget: !0,
215
233
  title: "Cancel strike"
216
234
  },
@@ -269,10 +287,10 @@ const z = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAYAAAD0eNT6AAA
269
287
  moreCols: 2,
270
288
  small: !0,
271
289
  moreItems: [
272
- { label: "≠", insert: "\\neq", title: "Not equal" },
273
- { label: "≉", insert: "\\not\\approx", title: "Not almost equal to" },
274
- { label: "≢", insert: "\\not\\equiv", title: "Not identical to" },
275
- { label: "≁", insert: "\\nsim", title: "Not similar" }
290
+ { label: "≠", insert: "\\class{cme-not-equal}{=}", title: "Not equal" },
291
+ { label: "≉", insert: "\\class{cme-not-approx}{\\approx}", title: "Not almost equal to" },
292
+ { label: "≢", insert: "\\class{cme-not-equiv}{\\equiv}", title: "Not identical to" },
293
+ { label: "≁", insert: "\\class{cme-not-sim}{\\sim}", title: "Not similar" }
276
294
  ]
277
295
  },
278
296
  { label: "=", insert: "=", title: "Equals" },
@@ -4265,7 +4283,7 @@ const z = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAYAAAD0eNT6AAA
4265
4283
  <rect x="9" y="7" width="6" height="10" rx="1" stroke="#2E7D32" stroke-width="2" fill="none" />
4266
4284
  <line x1="9" y1="21" x2="15" y2="3" stroke="#666" stroke-width="2" stroke-linecap="round" />
4267
4285
  </svg>`,
4268
- insert: "\\cancel{#?}",
4286
+ insert: "\\class{cme-cancel-strike}{#?}",
4269
4287
  isWidget: !0,
4270
4288
  title: "Cancel strike"
4271
4289
  },
@@ -4324,10 +4342,10 @@ const z = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAYAAAD0eNT6AAA
4324
4342
  moreCols: 2,
4325
4343
  small: !0,
4326
4344
  moreItems: [
4327
- { label: "≠", insert: "\\neq", title: "Not equal" },
4328
- { label: "≉", insert: "\\not\\approx", title: "Not almost equal to" },
4329
- { label: "≢", insert: "\\not\\equiv", title: "Not identical to" },
4330
- { label: "≁", insert: "\\not\\sim", title: "Not similar" }
4345
+ { label: "≠", insert: "\\class{cme-not-equal}{=}", title: "Not equal" },
4346
+ { label: "≉", insert: "\\class{cme-not-approx}{\\approx}", title: "Not almost equal to" },
4347
+ { label: "≢", insert: "\\class{cme-not-equiv}{\\equiv}", title: "Not identical to" },
4348
+ { label: "≁", insert: "\\class{cme-not-sim}{\\sim}", title: "Not similar" }
4331
4349
  ]
4332
4350
  },
4333
4351
  { label: "=", insert: "=", title: "Equals" },
@@ -7538,20 +7556,6 @@ const Z = "data-mathfield-shadow-styles", ot = `
7538
7556
  overflow: visible !important;
7539
7557
  contain: none !important;
7540
7558
  }
7541
- .ML__notation {
7542
- position: absolute !important;
7543
- line-height: 0 !important;
7544
- box-sizing: border-box !important;
7545
- }
7546
- .ML__notation svg {
7547
- position: absolute !important;
7548
- overflow: visible !important;
7549
- top: 0 !important;
7550
- left: 0 !important;
7551
- width: 100% !important;
7552
- height: 100% !important;
7553
- pointer-events: none !important;
7554
- }
7555
7559
  .wide-circle {
7556
7560
  display: inline-block !important;
7557
7561
  transform: scaleX(1.5) !important;
@@ -7651,8 +7655,8 @@ const Z = "data-mathfield-shadow-styles", ot = `
7651
7655
  position: absolute;
7652
7656
  top: 0; left: 0; right: 0; bottom: 0;
7653
7657
  background: currentColor;
7654
- -webkit-mask-image: url("data:image/svg+xml,%3Csvg preserveAspectRatio='none' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cline x1='0' y1='100' x2='100' y2='0' stroke='black' stroke-width='2' vector-effect='non-scaling-stroke' /%3E%3C/svg%3E");
7655
- mask-image: url("data:image/svg+xml,%3Csvg preserveAspectRatio='none' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cline x1='0' y1='100' x2='100' y2='0' stroke='black' stroke-width='2' vector-effect='non-scaling-stroke' /%3E%3C/svg%3E");
7658
+ -webkit-mask-image: url("data:image/svg+xml,%3Csvg preserveAspectRatio='none' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cline x1='0' y1='100' x2='100' y2='0' stroke='black' stroke-width='1.5' vector-effect='non-scaling-stroke' /%3E%3C/svg%3E");
7659
+ mask-image: url("data:image/svg+xml,%3Csvg preserveAspectRatio='none' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cline x1='0' y1='100' x2='100' y2='0' stroke='black' stroke-width='1.5' vector-effect='non-scaling-stroke' /%3E%3C/svg%3E");
7656
7660
  -webkit-mask-size: 100% 100%;
7657
7661
  mask-size: 100% 100%;
7658
7662
  pointer-events: none;
@@ -7666,8 +7670,8 @@ const Z = "data-mathfield-shadow-styles", ot = `
7666
7670
  position: absolute;
7667
7671
  top: 0; left: 0; right: 0; bottom: 0;
7668
7672
  background: currentColor;
7669
- -webkit-mask-image: url("data:image/svg+xml,%3Csvg preserveAspectRatio='none' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cline x1='0' y1='0' x2='100' y2='100' stroke='black' stroke-width='2' vector-effect='non-scaling-stroke' /%3E%3C/svg%3E");
7670
- mask-image: url("data:image/svg+xml,%3Csvg preserveAspectRatio='none' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cline x1='0' y1='0' x2='100' y2='100' stroke='black' stroke-width='2' vector-effect='non-scaling-stroke' /%3E%3C/svg%3E");
7673
+ -webkit-mask-image: url("data:image/svg+xml,%3Csvg preserveAspectRatio='none' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cline x1='0' y1='0' x2='100' y2='100' stroke='black' stroke-width='1.5' vector-effect='non-scaling-stroke' /%3E%3C/svg%3E");
7674
+ mask-image: url("data:image/svg+xml,%3Csvg preserveAspectRatio='none' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cline x1='0' y1='0' x2='100' y2='100' stroke='black' stroke-width='1.5' vector-effect='non-scaling-stroke' /%3E%3C/svg%3E");
7671
7675
  -webkit-mask-size: 100% 100%;
7672
7676
  mask-size: 100% 100%;
7673
7677
  pointer-events: none;
@@ -7681,8 +7685,8 @@ const Z = "data-mathfield-shadow-styles", ot = `
7681
7685
  position: absolute;
7682
7686
  top: 0; left: 0; right: 0; bottom: 0;
7683
7687
  background: currentColor;
7684
- -webkit-mask-image: url("data:image/svg+xml,%3Csvg preserveAspectRatio='none' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cline x1='0' y1='100' x2='100' y2='0' stroke='black' stroke-width='2' vector-effect='non-scaling-stroke' /%3E%3Cline x1='0' y1='0' x2='100' y2='100' stroke='black' stroke-width='2' vector-effect='non-scaling-stroke' /%3E%3C/svg%3E");
7685
- mask-image: url("data:image/svg+xml,%3Csvg preserveAspectRatio='none' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cline x1='0' y1='100' x2='100' y2='0' stroke='black' stroke-width='2' vector-effect='non-scaling-stroke' /%3E%3Cline x1='0' y1='0' x2='100' y2='100' stroke='black' stroke-width='2' vector-effect='non-scaling-stroke' /%3E%3C/svg%3E");
7688
+ -webkit-mask-image: url("data:image/svg+xml,%3Csvg preserveAspectRatio='none' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cline x1='0' y1='100' x2='100' y2='0' stroke='black' stroke-width='1.5' vector-effect='non-scaling-stroke' /%3E%3Cline x1='0' y1='0' x2='100' y2='100' stroke='black' stroke-width='1.5' vector-effect='non-scaling-stroke' /%3E%3C/svg%3E");
7689
+ mask-image: url("data:image/svg+xml,%3Csvg preserveAspectRatio='none' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cline x1='0' y1='100' x2='100' y2='0' stroke='black' stroke-width='1.5' vector-effect='non-scaling-stroke' /%3E%3Cline x1='0' y1='0' x2='100' y2='100' stroke='black' stroke-width='1.5' vector-effect='non-scaling-stroke' /%3E%3C/svg%3E");
7686
7690
  -webkit-mask-size: 100% 100%;
7687
7691
  mask-size: 100% 100%;
7688
7692
  pointer-events: none;
@@ -7696,8 +7700,32 @@ const Z = "data-mathfield-shadow-styles", ot = `
7696
7700
  position: absolute;
7697
7701
  top: 0; left: 0; right: 0; bottom: 0;
7698
7702
  background: currentColor;
7699
- -webkit-mask-image: url("data:image/svg+xml,%3Csvg preserveAspectRatio='none' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cline x1='0' y1='50' x2='100' y2='50' stroke='black' stroke-width='2' vector-effect='non-scaling-stroke' /%3E%3C/svg%3E");
7700
- mask-image: url("data:image/svg+xml,%3Csvg preserveAspectRatio='none' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cline x1='0' y1='50' x2='100' y2='50' stroke='black' stroke-width='2' vector-effect='non-scaling-stroke' /%3E%3C/svg%3E");
7703
+ -webkit-mask-image: url("data:image/svg+xml,%3Csvg preserveAspectRatio='none' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cline x1='0' y1='50' x2='100' y2='50' stroke='black' stroke-width='1.5' vector-effect='non-scaling-stroke' /%3E%3C/svg%3E");
7704
+ mask-image: url("data:image/svg+xml,%3Csvg preserveAspectRatio='none' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cline x1='0' y1='50' x2='100' y2='50' stroke='black' stroke-width='1.5' vector-effect='non-scaling-stroke' /%3E%3C/svg%3E");
7705
+ -webkit-mask-size: 100% 100%;
7706
+ mask-size: 100% 100%;
7707
+ pointer-events: none;
7708
+ }
7709
+ .cme-not-equal,
7710
+ .cme-not-approx,
7711
+ .cme-not-equiv,
7712
+ .cme-not-sim {
7713
+ display: inline-block;
7714
+ position: relative;
7715
+ }
7716
+ .cme-not-equal::after,
7717
+ .cme-not-approx::after,
7718
+ .cme-not-equiv::after,
7719
+ .cme-not-sim::after {
7720
+ content: '';
7721
+ position: absolute;
7722
+ top: -0.02em;
7723
+ bottom: -0.02em;
7724
+ left: 0;
7725
+ right: 0;
7726
+ background: currentColor;
7727
+ -webkit-mask-image: url("data:image/svg+xml,%3Csvg preserveAspectRatio='none' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cline x1='28' y1='86' x2='72' y2='14' stroke='black' stroke-width='1.5' vector-effect='non-scaling-stroke' stroke-linecap='round' /%3E%3C/svg%3E");
7728
+ mask-image: url("data:image/svg+xml,%3Csvg preserveAspectRatio='none' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cline x1='28' y1='86' x2='72' y2='14' stroke='black' stroke-width='1.5' vector-effect='non-scaling-stroke' stroke-linecap='round' /%3E%3C/svg%3E");
7701
7729
  -webkit-mask-size: 100% 100%;
7702
7730
  mask-size: 100% 100%;
7703
7731
  pointer-events: none;
@@ -7992,7 +8020,7 @@ class dt {
7992
8020
  this.close();
7993
8021
  }
7994
8022
  }
7995
- const mt = "1.0.29", E = {
8023
+ const mt = "1.0.31", E = {
7996
8024
  version: mt
7997
8025
  };
7998
8026
  typeof window < "u" && (window.MathfieldElement ? window.MathfieldElement.fontsDirectory = "https://cdn.jsdelivr.net/npm/mathlive/dist/fonts" : V && (V.fontsDirectory = "https://cdn.jsdelivr.net/npm/mathlive/dist/fonts"));
@@ -8473,28 +8501,28 @@ const D = class D {
8473
8501
  }
8474
8502
  const c = h.action === "BOLD", g = h.action === "ITALIC", x = h.action === "TEXT_COLOR", u = h.action === "SPECIAL_CHARS", y = c && this.activeStyles.bold || g && this.activeStyles.italic || x && this.activeStyles.color !== "none", w = document.createElement("button");
8475
8503
  w.type = "button", w.className = "cme-btn" + (e.isTemplate ? " template" : "") + (h.cls ? ` ${h.cls}` : "") + (y ? " active" : ""), w.title = h.title || h.label || h.insert || "", typeof h.label == "string" && (h.label.includes("<svg") || h.label.includes("<img") || h.label.includes("<strong") || h.label.includes("<em")) ? w.innerHTML = h.label : typeof h.label == "string" && (w.textContent = h.label), w.addEventListener("mousedown", (k) => {
8476
- var p, b, m, M, d, S, C, f, T, I;
8504
+ var p, b, m, M, d, S, C, v, T, I;
8477
8505
  k.preventDefault();
8478
8506
  const i = this.mathField;
8479
8507
  if (u) {
8480
8508
  this.closeAllPopups();
8481
- const v = w.getBoundingClientRect();
8482
- this.openSpecialCharacters(v);
8509
+ const f = w.getBoundingClientRect();
8510
+ this.openSpecialCharacters(f);
8483
8511
  } else if (x)
8484
8512
  if (this.colorPickerPopup && this.activeColorBtn === w)
8485
8513
  this.closeColorPicker();
8486
8514
  else {
8487
- const v = w.getBoundingClientRect();
8488
- this.openColorPicker(v, w);
8515
+ const f = w.getBoundingClientRect();
8516
+ this.openColorPicker(f, w);
8489
8517
  }
8490
8518
  else if (c) {
8491
8519
  if (this.closeAllPopups(), this.explicitToggle = !0, this.activeStyles.bold = !this.activeStyles.bold, i) {
8492
8520
  if (i.selectionIsCollapsed)
8493
8521
  this.activeStyles.bold || (i.styleBias = "none", i.defaultStyle && (delete i.defaultStyle.variantStyle, delete i.defaultStyle.fontSeries));
8494
8522
  else {
8495
- const v = this.getSelectionLatex(i);
8496
- if (v && v.trim()) {
8497
- const R = F(v.trim()), A = B(
8523
+ const f = this.getSelectionLatex(i);
8524
+ if (f && f.trim()) {
8525
+ const R = F(f.trim()), A = B(
8498
8526
  R,
8499
8527
  this.activeStyles.bold,
8500
8528
  this.activeStyles.italic,
@@ -8525,9 +8553,9 @@ const D = class D {
8525
8553
  if (i.selectionIsCollapsed)
8526
8554
  this.activeStyles.italic || (i.styleBias = "none", i.defaultStyle && (delete i.defaultStyle.variantStyle, delete i.defaultStyle.fontShape));
8527
8555
  else {
8528
- const v = this.getSelectionLatex(i);
8529
- if (v && v.trim()) {
8530
- const R = F(v.trim()), A = B(
8556
+ const f = this.getSelectionLatex(i);
8557
+ if (f && f.trim()) {
8558
+ const R = F(f.trim()), A = B(
8531
8559
  R,
8532
8560
  this.activeStyles.bold,
8533
8561
  this.activeStyles.italic,
@@ -8560,15 +8588,15 @@ const D = class D {
8560
8588
  else if (h.action === "CUT")
8561
8589
  this.closeAllPopups(), (d = i == null ? void 0 : i.focus) == null || d.call(i), (S = i == null ? void 0 : i.executeCommand) == null || S.call(i, "cutToClipboard");
8562
8590
  else if (h.action === "COPY")
8563
- this.closeAllPopups(), (C = i == null ? void 0 : i.focus) == null || C.call(i), (f = i == null ? void 0 : i.executeCommand) == null || f.call(i, "copyToClipboard");
8591
+ this.closeAllPopups(), (C = i == null ? void 0 : i.focus) == null || C.call(i), (v = i == null ? void 0 : i.executeCommand) == null || v.call(i, "copyToClipboard");
8564
8592
  else if (h.action === "PASTE")
8565
8593
  this.closeAllPopups(), (T = i == null ? void 0 : i.focus) == null || T.call(i), (I = i == null ? void 0 : i.executeCommand) == null || I.call(i, "pasteFromClipboard");
8566
8594
  else if (h.action === "MATRIX_HOVER")
8567
8595
  if (this.activeMatrixPopup && this.activeMatrixBtn === w)
8568
8596
  this.closeMatrixPopup();
8569
8597
  else {
8570
- const v = w.getBoundingClientRect();
8571
- this.openMatrixGrid(h.matrixType || "matrix", v, w);
8598
+ const f = w.getBoundingClientRect();
8599
+ this.openMatrixGrid(h.matrixType || "matrix", f, w);
8572
8600
  }
8573
8601
  else
8574
8602
  this.insertAtCursor(h);
@@ -8631,21 +8659,21 @@ const D = class D {
8631
8659
  const m = document.createElement("button");
8632
8660
  m.type = "button", m.className = "cme-matrix-insert-btn", m.textContent = "INSERT", h.appendChild(c), h.appendChild(m);
8633
8661
  const M = (d, S) => {
8634
- l = Math.max(1, Math.min(10, d)), n = Math.max(1, Math.min(10, S)), g.value = l, k.value = n, o.querySelectorAll(".cme-matrix-hover-cell").forEach((f) => {
8635
- const T = parseInt(f.dataset.row, 10), I = parseInt(f.dataset.col, 10);
8636
- T <= l && I <= n ? f.classList.add("selected") : f.classList.remove("selected");
8662
+ l = Math.max(1, Math.min(10, d)), n = Math.max(1, Math.min(10, S)), g.value = l, k.value = n, o.querySelectorAll(".cme-matrix-hover-cell").forEach((v) => {
8663
+ const T = parseInt(v.dataset.row, 10), I = parseInt(v.dataset.col, 10);
8664
+ T <= l && I <= n ? v.classList.add("selected") : v.classList.remove("selected");
8637
8665
  });
8638
8666
  };
8639
8667
  for (let d = 1; d <= 5; d++) {
8640
8668
  const S = document.createElement("div");
8641
8669
  S.className = "cme-matrix-hover-row";
8642
8670
  for (let C = 1; C <= 10; C++) {
8643
- const f = document.createElement("div");
8644
- f.className = "cme-matrix-hover-cell" + (d <= l && C <= n ? " selected" : ""), f.dataset.row = d, f.dataset.col = C, f.addEventListener("mouseenter", () => {
8671
+ const v = document.createElement("div");
8672
+ v.className = "cme-matrix-hover-cell" + (d <= l && C <= n ? " selected" : ""), v.dataset.row = d, v.dataset.col = C, v.addEventListener("mouseenter", () => {
8645
8673
  M(d, C);
8646
- }), f.addEventListener("click", (T) => {
8674
+ }), v.addEventListener("click", (T) => {
8647
8675
  T.stopPropagation(), this.insertMatrix(t, d, C), this.closeMatrixPopup();
8648
- }), S.appendChild(f);
8676
+ }), S.appendChild(v);
8649
8677
  }
8650
8678
  o.appendChild(S);
8651
8679
  }