@blogmcp/mdx-render-vue 0.1.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/_virtual/_plugin-vue_export-helper.js +10 -0
- package/dist/_virtual/constants.js +4 -0
- package/dist/_virtual/index.js +5 -0
- package/dist/_virtual/index2.js +4 -0
- package/dist/composables/index.d.ts +11 -0
- package/dist/composables/index.js +24 -0
- package/dist/composables/useAudioPlayer.d.ts +22 -0
- package/dist/composables/useAudioPlayer.js +58 -0
- package/dist/composables/useCallout.d.ts +43 -0
- package/dist/composables/useCallout.js +71 -0
- package/dist/composables/useCodeBlock.d.ts +23 -0
- package/dist/composables/useCodeBlock.js +67 -0
- package/dist/composables/useGallery.d.ts +37 -0
- package/dist/composables/useGallery.js +84 -0
- package/dist/composables/useMedia.d.ts +18 -0
- package/dist/composables/useMedia.js +9 -0
- package/dist/composables/useYouTube.d.ts +31 -0
- package/dist/composables/useYouTube.js +32 -0
- package/dist/edit/AlertEdit.vue.d.ts +12 -0
- package/dist/edit/AlertEdit.vue.js +4 -0
- package/dist/edit/AlertEdit.vue2.js +18 -0
- package/dist/edit/AudioPlayerEdit.vue.d.ts +3 -0
- package/dist/edit/AudioPlayerEdit.vue.js +117 -0
- package/dist/edit/AudioPlayerEdit.vue2.js +4 -0
- package/dist/edit/BadgeEdit.vue.d.ts +2 -0
- package/dist/edit/BadgeEdit.vue.js +4 -0
- package/dist/edit/BadgeEdit.vue2.js +13 -0
- package/dist/edit/ButtonEdit.vue.d.ts +2 -0
- package/dist/edit/ButtonEdit.vue.js +4 -0
- package/dist/edit/ButtonEdit.vue2.js +13 -0
- package/dist/edit/CalloutEdit.vue.d.ts +13 -0
- package/dist/edit/CalloutEdit.vue.js +85 -0
- package/dist/edit/CalloutEdit.vue2.js +4 -0
- package/dist/edit/CardEdit.vue.d.ts +12 -0
- package/dist/edit/CardEdit.vue.js +4 -0
- package/dist/edit/CardEdit.vue2.js +18 -0
- package/dist/edit/CodeBlockEdit.vue.d.ts +12 -0
- package/dist/edit/CodeBlockEdit.vue.js +7 -0
- package/dist/edit/CodeBlockEdit.vue2.js +89 -0
- package/dist/edit/GalleryEdit.vue.d.ts +3 -0
- package/dist/edit/GalleryEdit.vue.js +64 -0
- package/dist/edit/GalleryEdit.vue2.js +4 -0
- package/dist/edit/IconEdit.vue.d.ts +2 -0
- package/dist/edit/IconEdit.vue.js +4 -0
- package/dist/edit/IconEdit.vue2.js +13 -0
- package/dist/edit/TooltipEdit.vue.d.ts +16 -0
- package/dist/edit/TooltipEdit.vue.js +4 -0
- package/dist/edit/TooltipEdit.vue2.js +24 -0
- package/dist/edit/YouTubeEdit.vue.d.ts +3 -0
- package/dist/edit/YouTubeEdit.vue.js +41 -0
- package/dist/edit/YouTubeEdit.vue2.js +4 -0
- package/dist/edit/index.d.ts +29 -0
- package/dist/edit/index.js +35 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +75 -0
- package/dist/mdx-render-vue.css +31 -0
- package/dist/node_modules/@ark-ui/vue/dist/_virtual/_rolldown/runtime.js +13 -0
- package/dist/node_modules/@ark-ui/vue/dist/components/factory.js +35 -0
- package/dist/node_modules/@ark-ui/vue/dist/components/presence/use-presence-context.js +6 -0
- package/dist/node_modules/@ark-ui/vue/dist/components/presence/use-presence.js +40 -0
- package/dist/node_modules/@ark-ui/vue/dist/components/tooltip/tooltip-arrow-tip.js +5 -0
- package/dist/node_modules/@ark-ui/vue/dist/components/tooltip/tooltip-arrow-tip.vue_vue_type_script_setup_true_lang.js +21 -0
- package/dist/node_modules/@ark-ui/vue/dist/components/tooltip/tooltip-arrow.js +5 -0
- package/dist/node_modules/@ark-ui/vue/dist/components/tooltip/tooltip-arrow.vue_vue_type_script_setup_true_lang.js +21 -0
- package/dist/node_modules/@ark-ui/vue/dist/components/tooltip/tooltip-content.js +5 -0
- package/dist/node_modules/@ark-ui/vue/dist/components/tooltip/tooltip-content.vue_vue_type_script_setup_true_lang.js +25 -0
- package/dist/node_modules/@ark-ui/vue/dist/components/tooltip/tooltip-context.js +5 -0
- package/dist/node_modules/@ark-ui/vue/dist/components/tooltip/tooltip-context.vue_vue_type_script_setup_true_lang.js +14 -0
- package/dist/node_modules/@ark-ui/vue/dist/components/tooltip/tooltip-positioner.js +5 -0
- package/dist/node_modules/@ark-ui/vue/dist/components/tooltip/tooltip-positioner.vue_vue_type_script_setup_true_lang.js +23 -0
- package/dist/node_modules/@ark-ui/vue/dist/components/tooltip/tooltip-root-provider.js +5 -0
- package/dist/node_modules/@ark-ui/vue/dist/components/tooltip/tooltip-root-provider.vue_vue_type_script_setup_true_lang.js +38 -0
- package/dist/node_modules/@ark-ui/vue/dist/components/tooltip/tooltip-root.js +5 -0
- package/dist/node_modules/@ark-ui/vue/dist/components/tooltip/tooltip-root.vue_vue_type_script_setup_true_lang.js +68 -0
- package/dist/node_modules/@ark-ui/vue/dist/components/tooltip/tooltip-trigger.js +5 -0
- package/dist/node_modules/@ark-ui/vue/dist/components/tooltip/tooltip-trigger.vue_vue_type_script_setup_true_lang.js +25 -0
- package/dist/node_modules/@ark-ui/vue/dist/components/tooltip/tooltip.js +22 -0
- package/dist/node_modules/@ark-ui/vue/dist/components/tooltip/use-tooltip-context.js +6 -0
- package/dist/node_modules/@ark-ui/vue/dist/components/tooltip/use-tooltip.js +36 -0
- package/dist/node_modules/@ark-ui/vue/dist/providers/environment/use-environment-context.js +13 -0
- package/dist/node_modules/@ark-ui/vue/dist/providers/locale/use-locale-context.js +12 -0
- package/dist/node_modules/@ark-ui/vue/dist/utils/clean-props.js +8 -0
- package/dist/node_modules/@ark-ui/vue/dist/utils/create-context.js +14 -0
- package/dist/node_modules/@ark-ui/vue/dist/utils/dynamic.js +34 -0
- package/dist/node_modules/@ark-ui/vue/dist/utils/unref-element.js +8 -0
- package/dist/node_modules/@ark-ui/vue/dist/utils/use-forward-expose.js +46 -0
- package/dist/node_modules/@ark-ui/vue/dist/utils/use-render-strategy.js +5 -0
- package/dist/node_modules/@braintree/sanitize-url/dist/constants.js +20 -0
- package/dist/node_modules/@braintree/sanitize-url/dist/index.js +75 -0
- package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +728 -0
- package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +629 -0
- package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +176 -0
- package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +151 -0
- package/dist/node_modules/@iconify/vue/dist/iconify.js +1691 -0
- package/dist/node_modules/@zag-js/anatomy/dist/create-anatomy.js +29 -0
- package/dist/node_modules/@zag-js/core/dist/create-machine.js +28 -0
- package/dist/node_modules/@zag-js/core/dist/merge-props.js +55 -0
- package/dist/node_modules/@zag-js/core/dist/scope.js +20 -0
- package/dist/node_modules/@zag-js/core/dist/state.js +176 -0
- package/dist/node_modules/@zag-js/core/dist/types.js +11 -0
- package/dist/node_modules/@zag-js/dom-query/dist/chunk-QZ7TP4HQ.js +6 -0
- package/dist/node_modules/@zag-js/dom-query/dist/computed-style.js +11 -0
- package/dist/node_modules/@zag-js/dom-query/dist/event.js +37 -0
- package/dist/node_modules/@zag-js/dom-query/dist/node.js +64 -0
- package/dist/node_modules/@zag-js/dom-query/dist/overflow.js +28 -0
- package/dist/node_modules/@zag-js/dom-query/dist/platform.js +23 -0
- package/dist/node_modules/@zag-js/dom-query/dist/query.js +6 -0
- package/dist/node_modules/@zag-js/dom-query/dist/raf.js +52 -0
- package/dist/node_modules/@zag-js/dom-query/dist/set.js +22 -0
- package/dist/node_modules/@zag-js/dom-query/dist/shared.js +8 -0
- package/dist/node_modules/@zag-js/focus-visible/dist/index.js +159 -0
- package/dist/node_modules/@zag-js/popper/dist/get-anchor.js +39 -0
- package/dist/node_modules/@zag-js/popper/dist/get-placement.js +296 -0
- package/dist/node_modules/@zag-js/popper/dist/get-styles.js +47 -0
- package/dist/node_modules/@zag-js/popper/dist/middleware.js +79 -0
- package/dist/node_modules/@zag-js/popper/dist/placement.js +7 -0
- package/dist/node_modules/@zag-js/presence/dist/presence.connect.js +18 -0
- package/dist/node_modules/@zag-js/presence/dist/presence.machine.js +175 -0
- package/dist/node_modules/@zag-js/tooltip/dist/tooltip.anatomy.js +7 -0
- package/dist/node_modules/@zag-js/tooltip/dist/tooltip.connect.js +155 -0
- package/dist/node_modules/@zag-js/tooltip/dist/tooltip.dom.js +24 -0
- package/dist/node_modules/@zag-js/tooltip/dist/tooltip.machine.js +416 -0
- package/dist/node_modules/@zag-js/tooltip/dist/tooltip.store.js +9 -0
- package/dist/node_modules/@zag-js/types/dist/prop-types.js +14 -0
- package/dist/node_modules/@zag-js/utils/dist/array.js +7 -0
- package/dist/node_modules/@zag-js/utils/dist/equal.js +36 -0
- package/dist/node_modules/@zag-js/utils/dist/functions.js +11 -0
- package/dist/node_modules/@zag-js/utils/dist/guard.js +26 -0
- package/dist/node_modules/@zag-js/utils/dist/object.js +16 -0
- package/dist/node_modules/@zag-js/utils/dist/store.js +44 -0
- package/dist/node_modules/@zag-js/utils/dist/warning.js +31 -0
- package/dist/node_modules/@zag-js/vue/dist/bindable.js +48 -0
- package/dist/node_modules/@zag-js/vue/dist/machine.js +258 -0
- package/dist/node_modules/@zag-js/vue/dist/normalize-props.js +42 -0
- package/dist/node_modules/@zag-js/vue/dist/refs.js +14 -0
- package/dist/node_modules/@zag-js/vue/dist/track.js +22 -0
- package/dist/node_modules/dompurify/dist/purify.es.js +1190 -0
- package/dist/registry.d.ts +76 -0
- package/dist/registry.js +164 -0
- package/dist/render/alert/Alert.vue.d.ts +18 -0
- package/dist/render/alert/Alert.vue.js +4 -0
- package/dist/render/alert/Alert.vue2.js +43 -0
- package/dist/render/alert/index.d.ts +2 -0
- package/dist/render/audioplayer/AudioPlayerDefault.vue.d.ts +3 -0
- package/dist/render/audioplayer/AudioPlayerDefault.vue.js +116 -0
- package/dist/render/audioplayer/AudioPlayerDefault.vue2.js +4 -0
- package/dist/render/audioplayer/index.d.ts +5 -0
- package/dist/render/audioplayer/index.js +5 -0
- package/dist/render/badge/Badge.vue.d.ts +10 -0
- package/dist/render/badge/Badge.vue.js +4 -0
- package/dist/render/badge/Badge.vue2.js +28 -0
- package/dist/render/badge/index.d.ts +2 -0
- package/dist/render/button/Button.vue.d.ts +13 -0
- package/dist/render/button/Button.vue.js +4 -0
- package/dist/render/button/Button.vue2.js +42 -0
- package/dist/render/button/index.d.ts +2 -0
- package/dist/render/callout/CalloutDefault.vue.d.ts +13 -0
- package/dist/render/callout/CalloutDefault.vue.js +86 -0
- package/dist/render/callout/CalloutDefault.vue2.js +4 -0
- package/dist/render/callout/CalloutMinimal.vue.d.ts +13 -0
- package/dist/render/callout/CalloutMinimal.vue.js +27 -0
- package/dist/render/callout/CalloutMinimal.vue2.js +4 -0
- package/dist/render/callout/index.d.ts +6 -0
- package/dist/render/callout/index.js +7 -0
- package/dist/render/card/Card.vue.d.ts +15 -0
- package/dist/render/card/Card.vue.js +4 -0
- package/dist/render/card/Card.vue2.js +29 -0
- package/dist/render/card/index.d.ts +2 -0
- package/dist/render/codeblock/CodeBlockDefault.vue.d.ts +12 -0
- package/dist/render/codeblock/CodeBlockDefault.vue.js +7 -0
- package/dist/render/codeblock/CodeBlockDefault.vue2.js +92 -0
- package/dist/render/codeblock/index.d.ts +5 -0
- package/dist/render/codeblock/index.js +5 -0
- package/dist/render/gallery/GalleryGrid.vue.d.ts +3 -0
- package/dist/render/gallery/GalleryGrid.vue.js +125 -0
- package/dist/render/gallery/GalleryGrid.vue2.js +4 -0
- package/dist/render/gallery/GalleryLightbox.vue.d.ts +16 -0
- package/dist/render/gallery/GalleryLightbox.vue.js +7 -0
- package/dist/render/gallery/GalleryLightbox.vue2.js +170 -0
- package/dist/render/gallery/index.d.ts +6 -0
- package/dist/render/gallery/index.js +7 -0
- package/dist/render/icon/Icon.vue.d.ts +9 -0
- package/dist/render/icon/Icon.vue.js +4 -0
- package/dist/render/icon/Icon.vue2.js +25 -0
- package/dist/render/icon/index.d.ts +2 -0
- package/dist/render/index.d.ts +40 -0
- package/dist/render/index.js +63 -0
- package/dist/render/tooltip/Tooltip.vue.d.ts +18 -0
- package/dist/render/tooltip/Tooltip.vue.js +4 -0
- package/dist/render/tooltip/Tooltip.vue2.js +58 -0
- package/dist/render/tooltip/index.d.ts +2 -0
- package/dist/render/youtube/YouTubeDefault.vue.d.ts +3 -0
- package/dist/render/youtube/YouTubeDefault.vue.js +79 -0
- package/dist/render/youtube/YouTubeDefault.vue2.js +4 -0
- package/dist/render/youtube/index.d.ts +5 -0
- package/dist/render/youtube/index.js +5 -0
- package/dist/useAudioPlayer.d.ts +22 -0
- package/dist/useCallout.d.ts +46 -0
- package/dist/useCodeBlock.d.ts +25 -0
- package/dist/useGallery.d.ts +44 -0
- package/dist/useMedia.d.ts +16 -0
- package/dist/useYouTube.d.ts +32 -0
- package/package.json +125 -0
- package/src/composables/index.ts +16 -0
- package/src/composables/useAudioPlayer.ts +84 -0
- package/src/composables/useCallout.ts +103 -0
- package/src/composables/useCodeBlock.ts +90 -0
- package/src/composables/useGallery.ts +143 -0
- package/src/composables/useMedia.ts +23 -0
- package/src/composables/useYouTube.ts +58 -0
- package/src/edit/AlertEdit.vue +9 -0
- package/src/edit/AudioPlayerEdit.vue +92 -0
- package/src/edit/BadgeEdit.vue +7 -0
- package/src/edit/ButtonEdit.vue +10 -0
- package/src/edit/CalloutEdit.vue +107 -0
- package/src/edit/CardEdit.vue +9 -0
- package/src/edit/CodeBlockEdit.vue +76 -0
- package/src/edit/GalleryEdit.vue +65 -0
- package/src/edit/IconEdit.vue +7 -0
- package/src/edit/TooltipEdit.vue +15 -0
- package/src/edit/YouTubeEdit.vue +33 -0
- package/src/edit/index.ts +32 -0
- package/src/index.ts +62 -0
- package/src/registry.ts +272 -0
- package/src/render/alert/Alert.vue +32 -0
- package/src/render/alert/index.ts +2 -0
- package/src/render/audioplayer/AudioPlayerDefault.vue +89 -0
- package/src/render/audioplayer/index.ts +8 -0
- package/src/render/badge/Badge.vue +25 -0
- package/src/render/badge/index.ts +2 -0
- package/src/render/button/Button.vue +41 -0
- package/src/render/button/index.ts +2 -0
- package/src/render/callout/CalloutDefault.vue +101 -0
- package/src/render/callout/CalloutMinimal.vue +31 -0
- package/src/render/callout/index.ts +9 -0
- package/src/render/card/Card.vue +15 -0
- package/src/render/card/index.ts +2 -0
- package/src/render/codeblock/CodeBlockDefault.vue +76 -0
- package/src/render/codeblock/index.ts +8 -0
- package/src/render/gallery/GalleryGrid.vue +162 -0
- package/src/render/gallery/GalleryLightbox.vue +162 -0
- package/src/render/gallery/index.ts +9 -0
- package/src/render/icon/Icon.vue +22 -0
- package/src/render/icon/index.ts +2 -0
- package/src/render/index.ts +76 -0
- package/src/render/tooltip/Tooltip.vue +35 -0
- package/src/render/tooltip/index.ts +2 -0
- package/src/render/youtube/YouTubeDefault.vue +72 -0
- package/src/render/youtube/index.ts +8 -0
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
function hasWindow() {
|
|
2
|
+
return typeof window !== "undefined";
|
|
3
|
+
}
|
|
4
|
+
function getNodeName(node) {
|
|
5
|
+
if (isNode(node)) {
|
|
6
|
+
return (node.nodeName || "").toLowerCase();
|
|
7
|
+
}
|
|
8
|
+
return "#document";
|
|
9
|
+
}
|
|
10
|
+
function getWindow(node) {
|
|
11
|
+
var _node$ownerDocument;
|
|
12
|
+
return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
|
|
13
|
+
}
|
|
14
|
+
function getDocumentElement(node) {
|
|
15
|
+
var _ref;
|
|
16
|
+
return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
|
|
17
|
+
}
|
|
18
|
+
function isNode(value) {
|
|
19
|
+
if (!hasWindow()) {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
return value instanceof Node || value instanceof getWindow(value).Node;
|
|
23
|
+
}
|
|
24
|
+
function isElement(value) {
|
|
25
|
+
if (!hasWindow()) {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
return value instanceof Element || value instanceof getWindow(value).Element;
|
|
29
|
+
}
|
|
30
|
+
function isHTMLElement(value) {
|
|
31
|
+
if (!hasWindow()) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
|
|
35
|
+
}
|
|
36
|
+
function isShadowRoot(value) {
|
|
37
|
+
if (!hasWindow() || typeof ShadowRoot === "undefined") {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
|
|
41
|
+
}
|
|
42
|
+
function isOverflowElement(element) {
|
|
43
|
+
const {
|
|
44
|
+
overflow,
|
|
45
|
+
overflowX,
|
|
46
|
+
overflowY,
|
|
47
|
+
display
|
|
48
|
+
} = getComputedStyle(element);
|
|
49
|
+
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== "inline" && display !== "contents";
|
|
50
|
+
}
|
|
51
|
+
function isTableElement(element) {
|
|
52
|
+
return /^(table|td|th)$/.test(getNodeName(element));
|
|
53
|
+
}
|
|
54
|
+
function isTopLayer(element) {
|
|
55
|
+
try {
|
|
56
|
+
if (element.matches(":popover-open")) {
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
} catch (_e) {
|
|
60
|
+
}
|
|
61
|
+
try {
|
|
62
|
+
return element.matches(":modal");
|
|
63
|
+
} catch (_e) {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
const willChangeRe = /transform|translate|scale|rotate|perspective|filter/;
|
|
68
|
+
const containRe = /paint|layout|strict|content/;
|
|
69
|
+
const isNotNone = (value) => !!value && value !== "none";
|
|
70
|
+
let isWebKitValue;
|
|
71
|
+
function isContainingBlock(elementOrCss) {
|
|
72
|
+
const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss;
|
|
73
|
+
return isNotNone(css.transform) || isNotNone(css.translate) || isNotNone(css.scale) || isNotNone(css.rotate) || isNotNone(css.perspective) || !isWebKit() && (isNotNone(css.backdropFilter) || isNotNone(css.filter)) || willChangeRe.test(css.willChange || "") || containRe.test(css.contain || "");
|
|
74
|
+
}
|
|
75
|
+
function getContainingBlock(element) {
|
|
76
|
+
let currentNode = getParentNode(element);
|
|
77
|
+
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
78
|
+
if (isContainingBlock(currentNode)) {
|
|
79
|
+
return currentNode;
|
|
80
|
+
} else if (isTopLayer(currentNode)) {
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
currentNode = getParentNode(currentNode);
|
|
84
|
+
}
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
function isWebKit() {
|
|
88
|
+
if (isWebKitValue == null) {
|
|
89
|
+
isWebKitValue = typeof CSS !== "undefined" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none");
|
|
90
|
+
}
|
|
91
|
+
return isWebKitValue;
|
|
92
|
+
}
|
|
93
|
+
function isLastTraversableNode(node) {
|
|
94
|
+
return /^(html|body|#document)$/.test(getNodeName(node));
|
|
95
|
+
}
|
|
96
|
+
function getComputedStyle(element) {
|
|
97
|
+
return getWindow(element).getComputedStyle(element);
|
|
98
|
+
}
|
|
99
|
+
function getNodeScroll(element) {
|
|
100
|
+
if (isElement(element)) {
|
|
101
|
+
return {
|
|
102
|
+
scrollLeft: element.scrollLeft,
|
|
103
|
+
scrollTop: element.scrollTop
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
return {
|
|
107
|
+
scrollLeft: element.scrollX,
|
|
108
|
+
scrollTop: element.scrollY
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
function getParentNode(node) {
|
|
112
|
+
if (getNodeName(node) === "html") {
|
|
113
|
+
return node;
|
|
114
|
+
}
|
|
115
|
+
const result = (
|
|
116
|
+
// Step into the shadow DOM of the parent of a slotted node.
|
|
117
|
+
node.assignedSlot || // DOM Element detected.
|
|
118
|
+
node.parentNode || // ShadowRoot detected.
|
|
119
|
+
isShadowRoot(node) && node.host || // Fallback.
|
|
120
|
+
getDocumentElement(node)
|
|
121
|
+
);
|
|
122
|
+
return isShadowRoot(result) ? result.host : result;
|
|
123
|
+
}
|
|
124
|
+
function getNearestOverflowAncestor(node) {
|
|
125
|
+
const parentNode = getParentNode(node);
|
|
126
|
+
if (isLastTraversableNode(parentNode)) {
|
|
127
|
+
return node.ownerDocument ? node.ownerDocument.body : node.body;
|
|
128
|
+
}
|
|
129
|
+
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
|
|
130
|
+
return parentNode;
|
|
131
|
+
}
|
|
132
|
+
return getNearestOverflowAncestor(parentNode);
|
|
133
|
+
}
|
|
134
|
+
function getOverflowAncestors(node, list, traverseIframes) {
|
|
135
|
+
var _node$ownerDocument2;
|
|
136
|
+
if (list === void 0) {
|
|
137
|
+
list = [];
|
|
138
|
+
}
|
|
139
|
+
if (traverseIframes === void 0) {
|
|
140
|
+
traverseIframes = true;
|
|
141
|
+
}
|
|
142
|
+
const scrollableAncestor = getNearestOverflowAncestor(node);
|
|
143
|
+
const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
|
|
144
|
+
const win = getWindow(scrollableAncestor);
|
|
145
|
+
if (isBody) {
|
|
146
|
+
const frameElement = getFrameElement(win);
|
|
147
|
+
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
|
|
148
|
+
} else {
|
|
149
|
+
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
function getFrameElement(win) {
|
|
153
|
+
return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
|
|
154
|
+
}
|
|
155
|
+
export {
|
|
156
|
+
getComputedStyle,
|
|
157
|
+
getContainingBlock,
|
|
158
|
+
getDocumentElement,
|
|
159
|
+
getFrameElement,
|
|
160
|
+
getNearestOverflowAncestor,
|
|
161
|
+
getNodeName,
|
|
162
|
+
getNodeScroll,
|
|
163
|
+
getOverflowAncestors,
|
|
164
|
+
getParentNode,
|
|
165
|
+
getWindow,
|
|
166
|
+
isContainingBlock,
|
|
167
|
+
isElement,
|
|
168
|
+
isHTMLElement,
|
|
169
|
+
isLastTraversableNode,
|
|
170
|
+
isNode,
|
|
171
|
+
isOverflowElement,
|
|
172
|
+
isShadowRoot,
|
|
173
|
+
isTableElement,
|
|
174
|
+
isTopLayer,
|
|
175
|
+
isWebKit
|
|
176
|
+
};
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
const sides = ["top", "right", "bottom", "left"];
|
|
2
|
+
const min = Math.min;
|
|
3
|
+
const max = Math.max;
|
|
4
|
+
const round = Math.round;
|
|
5
|
+
const floor = Math.floor;
|
|
6
|
+
const createCoords = (v) => ({
|
|
7
|
+
x: v,
|
|
8
|
+
y: v
|
|
9
|
+
});
|
|
10
|
+
const oppositeSideMap = {
|
|
11
|
+
left: "right",
|
|
12
|
+
right: "left",
|
|
13
|
+
bottom: "top",
|
|
14
|
+
top: "bottom"
|
|
15
|
+
};
|
|
16
|
+
function clamp(start, value, end) {
|
|
17
|
+
return max(start, min(value, end));
|
|
18
|
+
}
|
|
19
|
+
function evaluate(value, param) {
|
|
20
|
+
return typeof value === "function" ? value(param) : value;
|
|
21
|
+
}
|
|
22
|
+
function getSide(placement) {
|
|
23
|
+
return placement.split("-")[0];
|
|
24
|
+
}
|
|
25
|
+
function getAlignment(placement) {
|
|
26
|
+
return placement.split("-")[1];
|
|
27
|
+
}
|
|
28
|
+
function getOppositeAxis(axis) {
|
|
29
|
+
return axis === "x" ? "y" : "x";
|
|
30
|
+
}
|
|
31
|
+
function getAxisLength(axis) {
|
|
32
|
+
return axis === "y" ? "height" : "width";
|
|
33
|
+
}
|
|
34
|
+
function getSideAxis(placement) {
|
|
35
|
+
const firstChar = placement[0];
|
|
36
|
+
return firstChar === "t" || firstChar === "b" ? "y" : "x";
|
|
37
|
+
}
|
|
38
|
+
function getAlignmentAxis(placement) {
|
|
39
|
+
return getOppositeAxis(getSideAxis(placement));
|
|
40
|
+
}
|
|
41
|
+
function getAlignmentSides(placement, rects, rtl) {
|
|
42
|
+
if (rtl === void 0) {
|
|
43
|
+
rtl = false;
|
|
44
|
+
}
|
|
45
|
+
const alignment = getAlignment(placement);
|
|
46
|
+
const alignmentAxis = getAlignmentAxis(placement);
|
|
47
|
+
const length = getAxisLength(alignmentAxis);
|
|
48
|
+
let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top";
|
|
49
|
+
if (rects.reference[length] > rects.floating[length]) {
|
|
50
|
+
mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
|
|
51
|
+
}
|
|
52
|
+
return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
|
|
53
|
+
}
|
|
54
|
+
function getExpandedPlacements(placement) {
|
|
55
|
+
const oppositePlacement = getOppositePlacement(placement);
|
|
56
|
+
return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
|
|
57
|
+
}
|
|
58
|
+
function getOppositeAlignmentPlacement(placement) {
|
|
59
|
+
return placement.includes("start") ? placement.replace("start", "end") : placement.replace("end", "start");
|
|
60
|
+
}
|
|
61
|
+
const lrPlacement = ["left", "right"];
|
|
62
|
+
const rlPlacement = ["right", "left"];
|
|
63
|
+
const tbPlacement = ["top", "bottom"];
|
|
64
|
+
const btPlacement = ["bottom", "top"];
|
|
65
|
+
function getSideList(side, isStart, rtl) {
|
|
66
|
+
switch (side) {
|
|
67
|
+
case "top":
|
|
68
|
+
case "bottom":
|
|
69
|
+
if (rtl) return isStart ? rlPlacement : lrPlacement;
|
|
70
|
+
return isStart ? lrPlacement : rlPlacement;
|
|
71
|
+
case "left":
|
|
72
|
+
case "right":
|
|
73
|
+
return isStart ? tbPlacement : btPlacement;
|
|
74
|
+
default:
|
|
75
|
+
return [];
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
|
|
79
|
+
const alignment = getAlignment(placement);
|
|
80
|
+
let list = getSideList(getSide(placement), direction === "start", rtl);
|
|
81
|
+
if (alignment) {
|
|
82
|
+
list = list.map((side) => side + "-" + alignment);
|
|
83
|
+
if (flipAlignment) {
|
|
84
|
+
list = list.concat(list.map(getOppositeAlignmentPlacement));
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return list;
|
|
88
|
+
}
|
|
89
|
+
function getOppositePlacement(placement) {
|
|
90
|
+
const side = getSide(placement);
|
|
91
|
+
return oppositeSideMap[side] + placement.slice(side.length);
|
|
92
|
+
}
|
|
93
|
+
function expandPaddingObject(padding) {
|
|
94
|
+
return {
|
|
95
|
+
top: 0,
|
|
96
|
+
right: 0,
|
|
97
|
+
bottom: 0,
|
|
98
|
+
left: 0,
|
|
99
|
+
...padding
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
function getPaddingObject(padding) {
|
|
103
|
+
return typeof padding !== "number" ? expandPaddingObject(padding) : {
|
|
104
|
+
top: padding,
|
|
105
|
+
right: padding,
|
|
106
|
+
bottom: padding,
|
|
107
|
+
left: padding
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
function rectToClientRect(rect) {
|
|
111
|
+
const {
|
|
112
|
+
x,
|
|
113
|
+
y,
|
|
114
|
+
width,
|
|
115
|
+
height
|
|
116
|
+
} = rect;
|
|
117
|
+
return {
|
|
118
|
+
width,
|
|
119
|
+
height,
|
|
120
|
+
top: y,
|
|
121
|
+
left: x,
|
|
122
|
+
right: x + width,
|
|
123
|
+
bottom: y + height,
|
|
124
|
+
x,
|
|
125
|
+
y
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
export {
|
|
129
|
+
clamp,
|
|
130
|
+
createCoords,
|
|
131
|
+
evaluate,
|
|
132
|
+
expandPaddingObject,
|
|
133
|
+
floor,
|
|
134
|
+
getAlignment,
|
|
135
|
+
getAlignmentAxis,
|
|
136
|
+
getAlignmentSides,
|
|
137
|
+
getAxisLength,
|
|
138
|
+
getExpandedPlacements,
|
|
139
|
+
getOppositeAlignmentPlacement,
|
|
140
|
+
getOppositeAxis,
|
|
141
|
+
getOppositeAxisPlacements,
|
|
142
|
+
getOppositePlacement,
|
|
143
|
+
getPaddingObject,
|
|
144
|
+
getSide,
|
|
145
|
+
getSideAxis,
|
|
146
|
+
max,
|
|
147
|
+
min,
|
|
148
|
+
rectToClientRect,
|
|
149
|
+
round,
|
|
150
|
+
sides
|
|
151
|
+
};
|