@diplodoc/transform 4.74.0 → 4.75.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/dist/css/_yfm-only.css +27 -0
- package/dist/css/_yfm-only.css.map +3 -3
- package/dist/css/_yfm-only.min.css +1 -1
- package/dist/css/_yfm-only.min.css.map +3 -3
- package/dist/css/base.css.map +1 -1
- package/dist/css/base.min.css.map +1 -1
- package/dist/css/print.css.map +1 -1
- package/dist/css/yfm.css +27 -0
- package/dist/css/yfm.css.map +3 -3
- package/dist/css/yfm.min.css +1 -1
- package/dist/css/yfm.min.css.map +3 -3
- package/dist/js/base.js +17 -11
- package/dist/js/base.js.map +2 -2
- package/dist/js/base.min.js +1 -1
- package/dist/js/base.min.js.map +3 -3
- package/dist/js/yfm.js +17 -11
- package/dist/js/yfm.js.map +2 -2
- package/dist/js/yfm.min.js +1 -1
- package/dist/js/yfm.min.js.map +3 -3
- package/dist/scss/_table.scss +13 -0
- package/dist/scss/_tooltip.scss +12 -0
- package/lib/plugins/inline-code/index.js +1 -6
- package/lib/plugins/inline-code/index.js.map +1 -1
- package/lib/plugins/table/index.js +187 -15
- package/lib/plugins/table/index.js.map +1 -1
- package/lib/plugins/table/types.d.ts +1 -0
- package/package.json +1 -1
- package/src/js/tooltip/constant.ts +2 -0
- package/src/js/tooltip/tooltip.ts +19 -15
- package/src/js/tooltip/types.ts +0 -1
- package/src/scss/_table.scss +13 -0
- package/src/scss/_tooltip.scss +12 -0
- package/src/transform/plugins/inline-code/index.ts +1 -7
- package/src/transform/plugins/table/index.ts +233 -20
- package/src/transform/plugins/table/types.ts +2 -0
package/dist/js/yfm.js
CHANGED
|
@@ -510,6 +510,7 @@
|
|
|
510
510
|
var TOOLTIP_BASE_CLASS = "yfm yfm-tooltip";
|
|
511
511
|
var TOOLTIP_OPEN_CLASS = "open";
|
|
512
512
|
var TOOLTIP_DATA_ATTR = "data-tooltip-id";
|
|
513
|
+
var TOOLTIP_LIVE_REGION_CLASS = "yfm-tooltip-live-region";
|
|
513
514
|
var DEFAULT_OFFSET_VALUES = { mainAxis: 5 };
|
|
514
515
|
var OPPOSITE_SIDES = {
|
|
515
516
|
top: "bottom",
|
|
@@ -697,6 +698,7 @@
|
|
|
697
698
|
function createTooltipFactory(options = {}) {
|
|
698
699
|
const { closeDelay = 1e3, additionalClassName } = options;
|
|
699
700
|
let initialized = false;
|
|
701
|
+
let liveRegion = null;
|
|
700
702
|
const state = {
|
|
701
703
|
currentId: null,
|
|
702
704
|
timer: null,
|
|
@@ -729,13 +731,19 @@
|
|
|
729
731
|
detachTooltip(tooltip3);
|
|
730
732
|
state.currentId = null;
|
|
731
733
|
}
|
|
734
|
+
if (liveRegion) {
|
|
735
|
+
liveRegion.textContent = "";
|
|
736
|
+
}
|
|
732
737
|
};
|
|
733
738
|
const show = (reference, text) => {
|
|
734
739
|
hide();
|
|
735
|
-
const tooltip3 = createTooltipElement({
|
|
740
|
+
const tooltip3 = createTooltipElement({ className: additionalClassName });
|
|
736
741
|
const update = updateTooltipPosition.bind(null, options, reference, tooltip3);
|
|
737
742
|
state.currentId = tooltip3.id;
|
|
738
|
-
attachTooltip(tooltip3, reference);
|
|
743
|
+
attachTooltip(tooltip3, reference, text);
|
|
744
|
+
if (liveRegion) {
|
|
745
|
+
liveRegion.textContent = text;
|
|
746
|
+
}
|
|
739
747
|
state.unsubscribe = subscribeToScroll(reference, update);
|
|
740
748
|
tooltip3.classList.add(TOOLTIP_OPEN_CLASS);
|
|
741
749
|
update();
|
|
@@ -757,6 +765,10 @@
|
|
|
757
765
|
const init = () => {
|
|
758
766
|
if (!initialized) {
|
|
759
767
|
initialized = true;
|
|
768
|
+
liveRegion = document.createElement("div");
|
|
769
|
+
liveRegion.className = TOOLTIP_LIVE_REGION_CLASS;
|
|
770
|
+
liveRegion.setAttribute("aria-live", "assertive");
|
|
771
|
+
document.body.appendChild(liveRegion);
|
|
760
772
|
window.addEventListener("scroll", handleUpdate);
|
|
761
773
|
window.addEventListener("resize", handleUpdate);
|
|
762
774
|
}
|
|
@@ -780,24 +792,18 @@
|
|
|
780
792
|
};
|
|
781
793
|
}
|
|
782
794
|
function createTooltipElement(options) {
|
|
783
|
-
const {
|
|
795
|
+
const { className } = options;
|
|
784
796
|
const id = generateId();
|
|
785
797
|
const tooltip3 = document.createElement("div");
|
|
786
798
|
tooltip3.id = id;
|
|
787
799
|
tooltip3.className = className ? `${TOOLTIP_BASE_CLASS} ${className}` : TOOLTIP_BASE_CLASS;
|
|
788
|
-
tooltip3.setAttribute("role", "tooltip");
|
|
789
|
-
tooltip3.setAttribute("aria-live", "polite");
|
|
790
|
-
tooltip3.textContent = text;
|
|
791
800
|
return tooltip3;
|
|
792
801
|
}
|
|
793
|
-
function attachTooltip(tooltip3, reference) {
|
|
802
|
+
function attachTooltip(tooltip3, reference, text) {
|
|
794
803
|
const container2 = document.querySelector(PAGE_CONTAINER_SELECTOR) || document.body;
|
|
795
|
-
const ariaLive = reference.getAttribute("aria-live");
|
|
796
804
|
reference.setAttribute(TOOLTIP_DATA_ATTR, tooltip3.id);
|
|
797
|
-
if (ariaLive) {
|
|
798
|
-
tooltip3.setAttribute("aria-live", ariaLive);
|
|
799
|
-
}
|
|
800
805
|
container2.appendChild(tooltip3);
|
|
806
|
+
tooltip3.textContent = text;
|
|
801
807
|
}
|
|
802
808
|
function detachTooltip(tooltip3) {
|
|
803
809
|
if (tooltip3.id) {
|