@w0s/footnote-reference-popover 7.2.1 → 7.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +46 -29
- package/dist/attribute/FootnoteElement.js +1 -1
- package/dist/attribute/FootnoteElement.js.map +1 -1
- package/dist/attribute/Mouseenter.d.ts +2 -2
- package/dist/attribute/Mouseenter.d.ts.map +1 -1
- package/dist/attribute/Mouseenter.js +7 -9
- package/dist/attribute/Mouseenter.js.map +1 -1
- package/dist/attribute/Mouseleave.d.ts +2 -2
- package/dist/attribute/Mouseleave.d.ts.map +1 -1
- package/dist/attribute/Mouseleave.js +7 -9
- package/dist/attribute/Mouseleave.js.map +1 -1
- package/dist/custom-element/Popover.d.ts +13 -6
- package/dist/custom-element/Popover.d.ts.map +1 -1
- package/dist/custom-element/Popover.js +77 -57
- package/dist/custom-element/Popover.js.map +1 -1
- package/dist/event/popover/mouseenter.d.ts +12 -0
- package/dist/event/popover/mouseenter.d.ts.map +1 -0
- package/dist/event/popover/mouseenter.js +16 -0
- package/dist/event/popover/mouseenter.js.map +1 -0
- package/dist/event/popover/mouseleave.d.ts +12 -0
- package/dist/event/popover/mouseleave.d.ts.map +1 -0
- package/dist/event/popover/mouseleave.js +16 -0
- package/dist/event/popover/mouseleave.js.map +1 -0
- package/dist/event/popover-hidden-button/click.d.ts +13 -0
- package/dist/event/popover-hidden-button/click.d.ts.map +1 -0
- package/dist/event/popover-hidden-button/click.js +11 -0
- package/dist/event/popover-hidden-button/click.js.map +1 -0
- package/dist/event/popover-trigger/click.d.ts +13 -0
- package/dist/event/popover-trigger/click.d.ts.map +1 -0
- package/dist/event/popover-trigger/click.js +14 -0
- package/dist/event/popover-trigger/click.js.map +1 -0
- package/dist/event/popover-trigger/mouseenter.d.ts +17 -0
- package/dist/event/popover-trigger/mouseenter.d.ts.map +1 -0
- package/dist/event/popover-trigger/mouseenter.js +29 -0
- package/dist/event/popover-trigger/mouseenter.js.map +1 -0
- package/dist/event/popover-trigger/mouseleave.d.ts +14 -0
- package/dist/event/popover-trigger/mouseleave.d.ts.map +1 -0
- package/dist/event/popover-trigger/mouseleave.js +15 -0
- package/dist/event/popover-trigger/mouseleave.js.map +1 -0
- package/dist/footnoteReferencePopover.d.ts +23 -0
- package/dist/footnoteReferencePopover.d.ts.map +1 -0
- package/dist/footnoteReferencePopover.js +143 -0
- package/dist/footnoteReferencePopover.js.map +1 -0
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/package.json +44 -48
- package/dist/FootnoteReferencePopover.d.ts +0 -11
- package/dist/FootnoteReferencePopover.d.ts.map +0 -1
- package/dist/FootnoteReferencePopover.js +0 -196
- package/dist/FootnoteReferencePopover.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"click.d.ts","sourceRoot":"","sources":["../../../src/event/popover-hidden-button/click.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,cAAc,MAAM,iCAAiC,CAAC;AAElE;;;;;;GAMG;yBAEF,KAAK,UAAU,EACf,MAAM,QAAQ,CAAC;IACd,cAAc,EAAE,cAAc,CAAC;CAC/B,CAAC,KACA,IAAI;AALP,wBAOE"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `click` event
|
|
3
|
+
*
|
|
4
|
+
* @param _ev - MouseEvent
|
|
5
|
+
* @param data - Elements, attributes and another data
|
|
6
|
+
* @param data.popoverElement - PopoverElement
|
|
7
|
+
*/
|
|
8
|
+
export default (_ev, data) => {
|
|
9
|
+
clearTimeout(data.popoverElement.mouseenterTimeoutId); // タッチデバイスで閉じるボタンをタップした際に `mouseenter` イベントの発火により表示処理が遅延実行されるのを防ぐ
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=click.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"click.js","sourceRoot":"","sources":["../../../src/event/popover-hidden-button/click.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,eAAe,CACd,GAAe,EACf,IAEE,EACK,EAAE;IACT,YAAY,CAAC,IAAI,CAAC,cAAc,CAAC,mBAAmB,CAAC,CAAC,CAAC,iEAAiE;AACzH,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type PopoverElement from '../../custom-element/Popover.ts';
|
|
2
|
+
/**
|
|
3
|
+
* `click` event
|
|
4
|
+
*
|
|
5
|
+
* @param ev - MouseEvent
|
|
6
|
+
* @param data - Elements, attributes and another data
|
|
7
|
+
* @param data.popoverElement - PopoverElement
|
|
8
|
+
*/
|
|
9
|
+
declare const _default: (ev: MouseEvent, data: Readonly<{
|
|
10
|
+
popoverElement: PopoverElement;
|
|
11
|
+
}>) => void;
|
|
12
|
+
export default _default;
|
|
13
|
+
//# sourceMappingURL=click.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"click.d.ts","sourceRoot":"","sources":["../../../src/event/popover-trigger/click.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,cAAc,MAAM,iCAAiC,CAAC;AAGlE;;;;;;GAMG;yBAEF,IAAI,UAAU,EACd,MAAM,QAAQ,CAAC;IACd,cAAc,EAAE,cAAc,CAAC;CAC/B,CAAC,KACA,IAAI;AALP,wBAWE"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { show } from "../../footnoteReferencePopover.js";
|
|
2
|
+
/**
|
|
3
|
+
* `click` event
|
|
4
|
+
*
|
|
5
|
+
* @param ev - MouseEvent
|
|
6
|
+
* @param data - Elements, attributes and another data
|
|
7
|
+
* @param data.popoverElement - PopoverElement
|
|
8
|
+
*/
|
|
9
|
+
export default (ev, data) => {
|
|
10
|
+
ev.preventDefault();
|
|
11
|
+
clearTimeout(data.popoverElement.mouseleaveTimeoutId);
|
|
12
|
+
show(ev.type, data.popoverElement);
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=click.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"click.js","sourceRoot":"","sources":["../../../src/event/popover-trigger/click.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,mCAAmC,CAAC;AAEzD;;;;;;GAMG;AACH,eAAe,CACd,EAAc,EACd,IAEE,EACK,EAAE;IACT,EAAE,CAAC,cAAc,EAAE,CAAC;IAEpB,YAAY,CAAC,IAAI,CAAC,cAAc,CAAC,mBAAmB,CAAC,CAAC;IAEtD,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;AACpC,CAAC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type PopoverElement from '../../custom-element/Popover.ts';
|
|
2
|
+
/**
|
|
3
|
+
* `mouseenter` event
|
|
4
|
+
*
|
|
5
|
+
* @param ev - MouseEvent
|
|
6
|
+
* @param data - Elements, attributes and another data
|
|
7
|
+
* @param data.popoverElement - PopoverElement
|
|
8
|
+
* @param data.delay - Delay time between mouse cursor moved within the trigger element and showing the popover (milliseconds)
|
|
9
|
+
* @param data.preloadImageSrc - Image path for preload
|
|
10
|
+
*/
|
|
11
|
+
declare const _default: (ev: MouseEvent, data: Readonly<{
|
|
12
|
+
popoverElement: PopoverElement;
|
|
13
|
+
delay: number;
|
|
14
|
+
preloadImageSrc: string | undefined;
|
|
15
|
+
}>) => void;
|
|
16
|
+
export default _default;
|
|
17
|
+
//# sourceMappingURL=mouseenter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mouseenter.d.ts","sourceRoot":"","sources":["../../../src/event/popover-trigger/mouseenter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,cAAc,MAAM,iCAAiC,CAAC;AAgBlE;;;;;;;;GAQG;yBAEF,IAAI,UAAU,EACd,MAAM,QAAQ,CAAC;IACd,cAAc,EAAE,cAAc,CAAC;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;CACpC,CAAC,KACA,IAAI;AAPP,wBAeE"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { show } from "../../footnoteReferencePopover.js";
|
|
2
|
+
/**
|
|
3
|
+
* Image preload
|
|
4
|
+
*
|
|
5
|
+
* @param imageSrc - Image path
|
|
6
|
+
*/
|
|
7
|
+
const preload = (imageSrc) => {
|
|
8
|
+
if (imageSrc === undefined || imageSrc.startsWith('data:')) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
new Image().src = imageSrc;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* `mouseenter` event
|
|
15
|
+
*
|
|
16
|
+
* @param ev - MouseEvent
|
|
17
|
+
* @param data - Elements, attributes and another data
|
|
18
|
+
* @param data.popoverElement - PopoverElement
|
|
19
|
+
* @param data.delay - Delay time between mouse cursor moved within the trigger element and showing the popover (milliseconds)
|
|
20
|
+
* @param data.preloadImageSrc - Image path for preload
|
|
21
|
+
*/
|
|
22
|
+
export default (ev, data) => {
|
|
23
|
+
clearTimeout(data.popoverElement.mouseleaveTimeoutId);
|
|
24
|
+
preload(data.preloadImageSrc);
|
|
25
|
+
data.popoverElement.mouseenterTimeoutId = setTimeout(() => {
|
|
26
|
+
show(ev.type, data.popoverElement);
|
|
27
|
+
}, data.delay);
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=mouseenter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mouseenter.js","sourceRoot":"","sources":["../../../src/event/popover-trigger/mouseenter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,mCAAmC,CAAC;AAEzD;;;;GAIG;AACH,MAAM,OAAO,GAAG,CAAC,QAA4B,EAAQ,EAAE;IACtD,IAAI,QAAQ,KAAK,SAAS,IAAI,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QAC5D,OAAO;IACR,CAAC;IAED,IAAI,KAAK,EAAE,CAAC,GAAG,GAAG,QAAQ,CAAC;AAC5B,CAAC,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAe,CACd,EAAc,EACd,IAIE,EACK,EAAE;IACT,YAAY,CAAC,IAAI,CAAC,cAAc,CAAC,mBAAmB,CAAC,CAAC;IAEtD,OAAO,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAE9B,IAAI,CAAC,cAAc,CAAC,mBAAmB,GAAG,UAAU,CAAC,GAAS,EAAE;QAC/D,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;IACpC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;AAChB,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type PopoverElement from '../../custom-element/Popover.ts';
|
|
2
|
+
/**
|
|
3
|
+
* `mouseleave` event
|
|
4
|
+
*
|
|
5
|
+
* @param ev - MouseEvent
|
|
6
|
+
* @param data - Elements, attributes and another data
|
|
7
|
+
* @param data.popoverElement - PopoverElement
|
|
8
|
+
*/
|
|
9
|
+
declare const _default: (ev: MouseEvent, data: Readonly<{
|
|
10
|
+
popoverElement: PopoverElement;
|
|
11
|
+
delay: number;
|
|
12
|
+
}>) => void;
|
|
13
|
+
export default _default;
|
|
14
|
+
//# sourceMappingURL=mouseleave.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mouseleave.d.ts","sourceRoot":"","sources":["../../../src/event/popover-trigger/mouseleave.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,cAAc,MAAM,iCAAiC,CAAC;AAGlE;;;;;;GAMG;yBAEF,IAAI,UAAU,EACd,MAAM,QAAQ,CAAC;IACd,cAAc,EAAE,cAAc,CAAC;IAC/B,KAAK,EAAE,MAAM,CAAC;CACd,CAAC,KACA,IAAI;AANP,wBAYE"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { hide } from "../../footnoteReferencePopover.js";
|
|
2
|
+
/**
|
|
3
|
+
* `mouseleave` event
|
|
4
|
+
*
|
|
5
|
+
* @param ev - MouseEvent
|
|
6
|
+
* @param data - Elements, attributes and another data
|
|
7
|
+
* @param data.popoverElement - PopoverElement
|
|
8
|
+
*/
|
|
9
|
+
export default (ev, data) => {
|
|
10
|
+
clearTimeout(data.popoverElement.mouseenterTimeoutId);
|
|
11
|
+
data.popoverElement.mouseleaveTimeoutId = setTimeout(() => {
|
|
12
|
+
hide(ev.type, data.popoverElement);
|
|
13
|
+
}, data.delay);
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=mouseleave.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mouseleave.js","sourceRoot":"","sources":["../../../src/event/popover-trigger/mouseleave.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,mCAAmC,CAAC;AAEzD;;;;;;GAMG;AACH,eAAe,CACd,EAAc,EACd,IAGE,EACK,EAAE;IACT,YAAY,CAAC,IAAI,CAAC,cAAc,CAAC,mBAAmB,CAAC,CAAC;IAEtD,IAAI,CAAC,cAAc,CAAC,mBAAmB,GAAG,UAAU,CAAC,GAAS,EAAE;QAC/D,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;IACpC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;AAChB,CAAC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import PopoverElement from './custom-element/Popover.ts';
|
|
2
|
+
/**
|
|
3
|
+
* ポップオーバーを表示する
|
|
4
|
+
*
|
|
5
|
+
* @param eventType - イベントの識別名
|
|
6
|
+
* @param popover - PopoverElement
|
|
7
|
+
*/
|
|
8
|
+
export declare const show: (eventType: string, popover: PopoverElement) => void;
|
|
9
|
+
/**
|
|
10
|
+
* ポップオーバーを非表示にする
|
|
11
|
+
*
|
|
12
|
+
* @param eventType - イベントの識別名
|
|
13
|
+
* @param popover - PopoverElement
|
|
14
|
+
*/
|
|
15
|
+
export declare const hide: (eventType: string, popover: PopoverElement) => void;
|
|
16
|
+
/**
|
|
17
|
+
* Footnote reference popover
|
|
18
|
+
*
|
|
19
|
+
* @param thisElement - Target element
|
|
20
|
+
*/
|
|
21
|
+
declare const _default: (thisElement: HTMLAnchorElement) => void;
|
|
22
|
+
export default _default;
|
|
23
|
+
//# sourceMappingURL=footnoteReferencePopover.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"footnoteReferencePopover.d.ts","sourceRoot":"","sources":["../src/footnoteReferencePopover.ts"],"names":[],"mappings":"AAMA,OAAO,cAA0C,MAAM,6BAA6B,CAAC;AAUrF;;;;;GAKG;AACH,eAAO,MAAM,IAAI,GAAI,WAAW,MAAM,EAAE,SAAS,cAAc,KAAG,IAwCjE,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,IAAI,GAAI,WAAW,MAAM,EAAE,SAAS,cAAc,KAAG,IAUjE,CAAC;AAEF;;;;GAIG;yBACa,aAAa,iBAAiB,KAAG,IAAI;AAArD,wBA0GE"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import FootnoteElementAttribute from "./attribute/FootnoteElement.js";
|
|
2
|
+
import MouseenterAttribute from "./attribute/Mouseenter.js";
|
|
3
|
+
import MouseleaveAttribute from "./attribute/Mouseleave.js";
|
|
4
|
+
import PopoverClassAttribute from "./attribute/PopoverClass.js";
|
|
5
|
+
import PopoverHideAttribute from "./attribute/PopoverHide.js";
|
|
6
|
+
import PopoverLabelAttribute from "./attribute/PopoverLabel.js";
|
|
7
|
+
import PopoverElement, {} from "./custom-element/Popover.js";
|
|
8
|
+
import popoverMouseenterEvent from "./event/popover/mouseenter.js";
|
|
9
|
+
import popoverMouseleaveEvent from "./event/popover/mouseleave.js";
|
|
10
|
+
import popoverHiddenButtonClickEvent from "./event/popover-hidden-button/click.js";
|
|
11
|
+
import popoverTriggerClickEvent from "./event/popover-trigger/click.js";
|
|
12
|
+
import popoverTriggerMouseenterEvent from "./event/popover-trigger/mouseenter.js";
|
|
13
|
+
import popoverTriggerMouseleaveEvent from "./event/popover-trigger/mouseleave.js";
|
|
14
|
+
const POPOVER_ELEMENT_NAME = 'x-popover';
|
|
15
|
+
/**
|
|
16
|
+
* ポップオーバーを表示する
|
|
17
|
+
*
|
|
18
|
+
* @param eventType - イベントの識別名
|
|
19
|
+
* @param popover - PopoverElement
|
|
20
|
+
*/
|
|
21
|
+
export const show = (eventType, popover) => {
|
|
22
|
+
if (!popover.isConnected) {
|
|
23
|
+
/* 初回表示時はポップオーバーの挿入を行う */
|
|
24
|
+
document.body.appendChild(popover);
|
|
25
|
+
}
|
|
26
|
+
const triggerRect = popover.triggerElement?.getBoundingClientRect();
|
|
27
|
+
if (triggerRect !== undefined) {
|
|
28
|
+
/* ポップオーバーの上位置を設定(トリガー要素の下端を基準にする) */
|
|
29
|
+
popover.style.width = 'auto';
|
|
30
|
+
popover.style.top = `${String(Math.round(triggerRect.bottom) + window.scrollY)}px`;
|
|
31
|
+
popover.style.right = 'auto';
|
|
32
|
+
popover.style.left = 'auto';
|
|
33
|
+
}
|
|
34
|
+
/* ポップオーバーを表示 */
|
|
35
|
+
const eventDetail = {
|
|
36
|
+
newState: 'open',
|
|
37
|
+
eventType: eventType,
|
|
38
|
+
};
|
|
39
|
+
popover.dispatchEvent(new CustomEvent('my-toggle', {
|
|
40
|
+
detail: eventDetail,
|
|
41
|
+
}));
|
|
42
|
+
if (triggerRect !== undefined) {
|
|
43
|
+
/* ポップオーバーの左右位置を設定(トリガー要素の左端を基準にする) */
|
|
44
|
+
const documentWidth = document.documentElement.offsetWidth;
|
|
45
|
+
const popoverWidth = popover.width;
|
|
46
|
+
const triggerRectLeft = triggerRect.left;
|
|
47
|
+
popover.style.width = `${String(popoverWidth)}px`;
|
|
48
|
+
if (documentWidth - triggerRectLeft < popoverWidth) {
|
|
49
|
+
popover.style.right = '0';
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
popover.style.left = `${String(triggerRectLeft)}px`;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* ポップオーバーを非表示にする
|
|
58
|
+
*
|
|
59
|
+
* @param eventType - イベントの識別名
|
|
60
|
+
* @param popover - PopoverElement
|
|
61
|
+
*/
|
|
62
|
+
export const hide = (eventType, popover) => {
|
|
63
|
+
const eventDetail = {
|
|
64
|
+
newState: 'closed',
|
|
65
|
+
eventType: eventType,
|
|
66
|
+
};
|
|
67
|
+
popover.dispatchEvent(new CustomEvent('my-toggle', {
|
|
68
|
+
detail: eventDetail,
|
|
69
|
+
}));
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Footnote reference popover
|
|
73
|
+
*
|
|
74
|
+
* @param thisElement - Target element
|
|
75
|
+
*/
|
|
76
|
+
export default (thisElement) => {
|
|
77
|
+
if (!('showPopover' in thisElement)) {
|
|
78
|
+
console.info('This browser does not support popover');
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
const { href: hrefAttributeValue } = thisElement;
|
|
82
|
+
const { popoverLabel: popoverLabelAttributeValue, popoverClass: popoverClassAttributeValue, popoverHideText: popoverHideTextAttributeValue, popoverHideImageSrc: popoverHideImageSrcAttributeValue, popoverHideImageWidth: popoverHideImageWidthAttributeValue, popoverHideImageHeight: popoverHideImageHeightAttributeValue, mouseenterDelay: mouseenterDelayAttributeValue, mouseleaveDelay: mouseleaveDelayAttributeValue, } = thisElement.dataset;
|
|
83
|
+
const footnoteElement = new FootnoteElementAttribute(hrefAttributeValue);
|
|
84
|
+
const popoverLabel = new PopoverLabelAttribute(popoverLabelAttributeValue);
|
|
85
|
+
const popoverClass = new PopoverClassAttribute(popoverClassAttributeValue);
|
|
86
|
+
const popoverHide = new PopoverHideAttribute({
|
|
87
|
+
text: popoverHideTextAttributeValue,
|
|
88
|
+
imageSrc: popoverHideImageSrcAttributeValue,
|
|
89
|
+
imageWidth: popoverHideImageWidthAttributeValue,
|
|
90
|
+
imageHeight: popoverHideImageHeightAttributeValue,
|
|
91
|
+
});
|
|
92
|
+
const mouseenter = new MouseenterAttribute({ delay: mouseenterDelayAttributeValue ?? '250' });
|
|
93
|
+
const mouseleave = new MouseleaveAttribute({ delay: mouseleaveDelayAttributeValue ?? '250' });
|
|
94
|
+
if (customElements.get(POPOVER_ELEMENT_NAME) === undefined) {
|
|
95
|
+
customElements.define(POPOVER_ELEMENT_NAME, PopoverElement);
|
|
96
|
+
}
|
|
97
|
+
const popoverElement = document.createElement(POPOVER_ELEMENT_NAME);
|
|
98
|
+
if (popoverClass.name !== undefined) {
|
|
99
|
+
popoverElement.className = popoverClass.name;
|
|
100
|
+
}
|
|
101
|
+
popoverElement.ariaLabel = popoverLabel.text ?? null;
|
|
102
|
+
popoverElement.hideText = popoverHide.text ?? null;
|
|
103
|
+
popoverElement.hideImageSrc = popoverHide.imageSrc ?? null;
|
|
104
|
+
popoverElement.hideImageWidth = popoverHide.imageWidth ?? null;
|
|
105
|
+
popoverElement.hideImageHeight = popoverHide.imageHeight ?? null;
|
|
106
|
+
popoverElement.triggerElement = thisElement;
|
|
107
|
+
popoverElement.insertAdjacentHTML('afterbegin', 'getHTML' in footnoteElement.element ? footnoteElement.element.getHTML() : footnoteElement.element.innerHTML);
|
|
108
|
+
thisElement.setAttribute('role', 'button');
|
|
109
|
+
thisElement.addEventListener('click', (ev) => {
|
|
110
|
+
popoverTriggerClickEvent(ev, {
|
|
111
|
+
popoverElement: popoverElement,
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
thisElement.addEventListener('mouseenter', (ev) => {
|
|
115
|
+
popoverTriggerMouseenterEvent(ev, {
|
|
116
|
+
popoverElement: popoverElement,
|
|
117
|
+
delay: mouseenter.delay,
|
|
118
|
+
preloadImageSrc: popoverHide.imageSrc,
|
|
119
|
+
});
|
|
120
|
+
}, { passive: true });
|
|
121
|
+
thisElement.addEventListener('mouseleave', (ev) => {
|
|
122
|
+
popoverTriggerMouseleaveEvent(ev, {
|
|
123
|
+
popoverElement: popoverElement,
|
|
124
|
+
delay: mouseleave.delay,
|
|
125
|
+
});
|
|
126
|
+
}, { passive: true });
|
|
127
|
+
popoverElement.addEventListener('mouseenter', (ev) => {
|
|
128
|
+
popoverMouseenterEvent(ev, {
|
|
129
|
+
delay: mouseenter.delay,
|
|
130
|
+
});
|
|
131
|
+
}, { passive: true });
|
|
132
|
+
popoverElement.addEventListener('mouseleave', (ev) => {
|
|
133
|
+
popoverMouseleaveEvent(ev, {
|
|
134
|
+
delay: mouseenter.delay,
|
|
135
|
+
});
|
|
136
|
+
}, { passive: true });
|
|
137
|
+
popoverElement.hideButtonElement.addEventListener('click', (ev) => {
|
|
138
|
+
popoverHiddenButtonClickEvent(ev, {
|
|
139
|
+
popoverElement: popoverElement,
|
|
140
|
+
});
|
|
141
|
+
}, { passive: true });
|
|
142
|
+
};
|
|
143
|
+
//# sourceMappingURL=footnoteReferencePopover.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"footnoteReferencePopover.js","sourceRoot":"","sources":["../src/footnoteReferencePopover.ts"],"names":[],"mappings":"AAAA,OAAO,wBAAwB,MAAM,gCAAgC,CAAC;AACtE,OAAO,mBAAmB,MAAM,2BAA2B,CAAC;AAC5D,OAAO,mBAAmB,MAAM,2BAA2B,CAAC;AAC5D,OAAO,qBAAqB,MAAM,6BAA6B,CAAC;AAChE,OAAO,oBAAoB,MAAM,4BAA4B,CAAC;AAC9D,OAAO,qBAAqB,MAAM,6BAA6B,CAAC;AAChE,OAAO,cAAc,EAAE,EAA0B,MAAM,6BAA6B,CAAC;AACrF,OAAO,sBAAsB,MAAM,+BAA+B,CAAC;AACnE,OAAO,sBAAsB,MAAM,+BAA+B,CAAC;AACnE,OAAO,6BAA6B,MAAM,wCAAwC,CAAC;AACnF,OAAO,wBAAwB,MAAM,kCAAkC,CAAC;AACxE,OAAO,6BAA6B,MAAM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AAK,EAAE,UAAU,CAAC,KAAK;SACvB,CAAC,CAAC;IACJ,CAAC,EACD,EAAE,OAAO,EAAE,IAAI,EAAE,CACjB,CAAC;IAEF,cAAc,CAAC,iBAAiB,CAAC,gBAAgB,CAChD,OAAO,EACP,CAAC,EAAc,EAAE,EAAE;QAClB,6BAA6B,CAAC,EAAE,EAAE;YACjC,cAAc,EAAE,cAAc;SAC9B,CAAC,CAAC;IACJ,CAAC,EACD,EAAE,OAAO,EAAE,IAAI,EAAE,CACjB,CAAC;AACH,CAAC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import footnoteReferencePopover from "./footnoteReferencePopover.js";
|
|
2
2
|
const validate = (element) => {
|
|
3
3
|
if (!(element instanceof HTMLAnchorElement)) {
|
|
4
4
|
throw new Error('Element must be a `HTMLAnchorElement`');
|
|
@@ -10,11 +10,11 @@ export default (elementOrElements) => {
|
|
|
10
10
|
return;
|
|
11
11
|
}
|
|
12
12
|
if (elementOrElements instanceof Element) {
|
|
13
|
-
|
|
13
|
+
footnoteReferencePopover(validate(elementOrElements));
|
|
14
14
|
}
|
|
15
15
|
else {
|
|
16
16
|
Array.from(elementOrElements).forEach((element) => {
|
|
17
|
-
|
|
17
|
+
footnoteReferencePopover(validate(element));
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
20
|
};
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,wBAAwB,MAAM,+BAA+B,CAAC;AAErE,MAAM,QAAQ,GAAG,CAAC,OAAgB,EAAqB,EAAE;IACxD,IAAI,CAAC,CAAC,OAAO,YAAY,iBAAiB,CAAC,EAAE,CAAC;QAC7C,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;IAC1D,CAAC;IAED,OAAO,OAAO,CAAC;AAChB,CAAC,CAAC;AAEF,eAAe,CAAC,iBAAmF,EAAQ,EAAE;IAC5G,IAAI,iBAAiB,KAAK,IAAI,EAAE,CAAC;QAChC,OAAO;IACR,CAAC;IAED,IAAI,iBAAiB,YAAY,OAAO,EAAE,CAAC;QAC1C,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,wBAAwB,MAAM,+BAA+B,CAAC;AAErE,MAAM,QAAQ,GAAG,CAAC,OAAgB,EAAqB,EAAE;IACxD,IAAI,CAAC,CAAC,OAAO,YAAY,iBAAiB,CAAC,EAAE,CAAC;QAC7C,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;IAC1D,CAAC;IAED,OAAO,OAAO,CAAC;AAChB,CAAC,CAAC;AAEF,eAAe,CAAC,iBAAmF,EAAQ,EAAE;IAC5G,IAAI,iBAAiB,KAAK,IAAI,EAAE,CAAC;QAChC,OAAO;IACR,CAAC;IAED,IAAI,iBAAiB,YAAY,OAAO,EAAE,CAAC;QAC1C,wBAAwB,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC,CAAC;IACvD,CAAC;SAAM,CAAC;QACP,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YACjD,wBAAwB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;QAC7C,CAAC,CAAC,CAAC;IACJ,CAAC;AACF,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,48 +1,44 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@w0s/footnote-reference-popover",
|
|
3
|
-
"version": "7.
|
|
4
|
-
"description": "Footnote reference popover",
|
|
5
|
-
"keywords": [
|
|
6
|
-
"footnote",
|
|
7
|
-
"popover"
|
|
8
|
-
],
|
|
9
|
-
"homepage": "https://github.com/SaekiTominaga/js-library-browser#readme",
|
|
10
|
-
"bugs": {
|
|
11
|
-
"url": "https://github.com/SaekiTominaga/js-library-browser/issues"
|
|
12
|
-
},
|
|
13
|
-
"license": "MIT",
|
|
14
|
-
"author": "Saeki Tominaga",
|
|
15
|
-
"files": [
|
|
16
|
-
"dist/**/*.d.ts",
|
|
17
|
-
"!dist/**/*.test.d.ts",
|
|
18
|
-
"dist/**/*.d.ts.map",
|
|
19
|
-
"!dist/**/*.test.d.ts.map",
|
|
20
|
-
"dist/**/*.js",
|
|
21
|
-
"!dist/**/*.test.js",
|
|
22
|
-
"dist/**/*.js.map",
|
|
23
|
-
"!dist/**/*.test.js.map"
|
|
24
|
-
],
|
|
25
|
-
"type": "module",
|
|
26
|
-
"main": "dist/index.js",
|
|
27
|
-
"module": "dist/index.js",
|
|
28
|
-
"types": "dist/index.d.ts",
|
|
29
|
-
"repository": {
|
|
30
|
-
"type": "git",
|
|
31
|
-
"url": "git+https://github.com/SaekiTominaga/js-library-browser.git"
|
|
32
|
-
},
|
|
33
|
-
"scripts": {
|
|
34
|
-
"
|
|
35
|
-
"prebuild": "rimraf dist/* -g",
|
|
36
|
-
"build": "tsc",
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
"publishConfig": {
|
|
46
|
-
"access": "public"
|
|
47
|
-
}
|
|
48
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@w0s/footnote-reference-popover",
|
|
3
|
+
"version": "7.3.1",
|
|
4
|
+
"description": "Footnote reference popover",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"footnote",
|
|
7
|
+
"popover"
|
|
8
|
+
],
|
|
9
|
+
"homepage": "https://github.com/SaekiTominaga/js-library-browser#readme",
|
|
10
|
+
"bugs": {
|
|
11
|
+
"url": "https://github.com/SaekiTominaga/js-library-browser/issues"
|
|
12
|
+
},
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"author": "Saeki Tominaga",
|
|
15
|
+
"files": [
|
|
16
|
+
"dist/**/*.d.ts",
|
|
17
|
+
"!dist/**/*.test.d.ts",
|
|
18
|
+
"dist/**/*.d.ts.map",
|
|
19
|
+
"!dist/**/*.test.d.ts.map",
|
|
20
|
+
"dist/**/*.js",
|
|
21
|
+
"!dist/**/*.test.js",
|
|
22
|
+
"dist/**/*.js.map",
|
|
23
|
+
"!dist/**/*.test.js.map"
|
|
24
|
+
],
|
|
25
|
+
"type": "module",
|
|
26
|
+
"main": "dist/index.js",
|
|
27
|
+
"module": "dist/index.js",
|
|
28
|
+
"types": "dist/index.d.ts",
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "git+https://github.com/SaekiTominaga/js-library-browser.git"
|
|
32
|
+
},
|
|
33
|
+
"scripts": {
|
|
34
|
+
"dev": "conc \"http-server -o demo -c-1\" \"tsc -w\"",
|
|
35
|
+
"prebuild": "rimraf dist/* -g",
|
|
36
|
+
"build": "tsc",
|
|
37
|
+
"lint": "eslint src/**/*.ts",
|
|
38
|
+
"pretest": "npm run build",
|
|
39
|
+
"test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest dist/.+\\.test\\.js -c ../../jest.config.mjs --roots packages/footnote-reference-popover"
|
|
40
|
+
},
|
|
41
|
+
"publishConfig": {
|
|
42
|
+
"access": "public"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FootnoteReferencePopover.d.ts","sourceRoot":"","sources":["../src/FootnoteReferencePopover.ts"],"names":[],"mappings":"AAUA;;GAEG;AACH,MAAM,CAAC,OAAO;;IAuBb;;OAEG;gBACS,WAAW,EAAE,iBAAiB;CAkO1C"}
|