@vingy/vueltip 0.3.0 → 1.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/dist/index.d.mts +30 -6
- package/dist/index.mjs +10 -9
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as __reExport, t as __exportAll } from "./chunk-CtajNgzt.mjs";
|
|
2
2
|
import * as Vue from "vue";
|
|
3
|
-
import { App, Component, ShallowRef, StyleValue } from "vue";
|
|
3
|
+
import { App, Component, Directive, ShallowRef, StyleValue } from "vue";
|
|
4
4
|
|
|
5
5
|
//#region ../../node_modules/.pnpm/@floating-ui+utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.d.mts
|
|
6
6
|
declare type AlignedPlacement = `${Side}-${Alignment}`;
|
|
@@ -248,6 +248,11 @@ declare type UseFloatingOptions<T extends ReferenceElement = ReferenceElement> =
|
|
|
248
248
|
interface Content {
|
|
249
249
|
text: string;
|
|
250
250
|
}
|
|
251
|
+
type Binding = string | {
|
|
252
|
+
content: string | Content;
|
|
253
|
+
placement: Placement;
|
|
254
|
+
};
|
|
255
|
+
type TooltipDirective = Directive<HTMLElement, Binding>;
|
|
251
256
|
type Options = {
|
|
252
257
|
/** @default 'tooltip-placement' */placementAttribute: string; /** @default 'tooltip-key' */
|
|
253
258
|
keyAttribute: string; /** @default 0 */
|
|
@@ -263,9 +268,18 @@ type UseTooltipOptions = {
|
|
|
263
268
|
arrowSize?: number;
|
|
264
269
|
floatingOptions?: UseFloatingOptions<HTMLElement>;
|
|
265
270
|
};
|
|
271
|
+
declare module 'vue' {
|
|
272
|
+
interface GlobalDirectives {
|
|
273
|
+
vTooltip: TooltipDirective;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
//#endregion
|
|
277
|
+
//#region ../shared/dist/types.d.mts
|
|
278
|
+
//#region src/types.d.ts
|
|
279
|
+
type Maybe<T> = T | null | undefined; //#endregion
|
|
266
280
|
//#endregion
|
|
267
281
|
//#region src/composables.d.ts
|
|
268
|
-
declare const
|
|
282
|
+
declare const useVueltip: ({
|
|
269
283
|
tooltipElement,
|
|
270
284
|
arrowElement,
|
|
271
285
|
offset: _offset,
|
|
@@ -291,11 +305,21 @@ declare const useTooltip: ({
|
|
|
291
305
|
content: Vue.Ref<Maybe<Content>, Maybe<Content>>;
|
|
292
306
|
};
|
|
293
307
|
//#endregion
|
|
308
|
+
//#region src/directive.d.ts
|
|
309
|
+
declare const vueltipDirective: {
|
|
310
|
+
updated: (el: HTMLElement, binding: Vue.DirectiveBinding<Binding, string, any>) => void;
|
|
311
|
+
created: (el: HTMLElement, binding: Vue.DirectiveBinding<Binding, string, any>) => void;
|
|
312
|
+
beforeUnmount: (el: HTMLElement) => void;
|
|
313
|
+
};
|
|
314
|
+
//#endregion
|
|
315
|
+
//#region src/options.d.ts
|
|
316
|
+
declare const setOptions: (opts?: Partial<Options>) => void;
|
|
317
|
+
//#endregion
|
|
294
318
|
//#region src/plugin.d.ts
|
|
295
|
-
declare const
|
|
296
|
-
install: (app: App, options: Partial<Options
|
|
319
|
+
declare const vueltipPlugin: {
|
|
320
|
+
install: (app: App, options: Partial<Options & {
|
|
297
321
|
component: Component;
|
|
298
|
-
}) => void;
|
|
322
|
+
}>) => void;
|
|
299
323
|
};
|
|
300
324
|
//#endregion
|
|
301
|
-
export { type Content,
|
|
325
|
+
export { type Content, setOptions, useVueltip, vueltipDirective, vueltipPlugin };
|
package/dist/index.mjs
CHANGED
|
@@ -1390,8 +1390,8 @@ function useFloating(reference, floating, options) {
|
|
|
1390
1390
|
//#endregion
|
|
1391
1391
|
//#region src/options.ts
|
|
1392
1392
|
let options = {
|
|
1393
|
-
placementAttribute: "
|
|
1394
|
-
keyAttribute: "
|
|
1393
|
+
placementAttribute: "vueltip-placement",
|
|
1394
|
+
keyAttribute: "vueltip-key",
|
|
1395
1395
|
showDelay: 0,
|
|
1396
1396
|
hideDelay: 200,
|
|
1397
1397
|
handleDialogModals: false
|
|
@@ -1441,7 +1441,7 @@ const sideMap = {
|
|
|
1441
1441
|
bottom: "top",
|
|
1442
1442
|
left: "right"
|
|
1443
1443
|
};
|
|
1444
|
-
const
|
|
1444
|
+
const useVueltip = ({ tooltipElement, arrowElement, offset: _offset, padding, arrowSize, floatingOptions }) => {
|
|
1445
1445
|
let initialParent;
|
|
1446
1446
|
onMounted(() => {
|
|
1447
1447
|
initialParent = tooltipElement.value?.parentElement;
|
|
@@ -1547,7 +1547,7 @@ const onMouseout = ensureEventTarget((target) => {
|
|
|
1547
1547
|
//#region src/directive.ts
|
|
1548
1548
|
const toContent = (value) => typeof value === "string" ? { text: value } : typeof value.content === "string" ? { text: value.content } : value.content;
|
|
1549
1549
|
const extractPlacement = (value) => typeof value === "string" ? "top" : value.placement;
|
|
1550
|
-
const
|
|
1550
|
+
const vueltipDirective = {
|
|
1551
1551
|
updated: (el, binding) => {
|
|
1552
1552
|
ensureKey(el, (key) => setContent(key, toContent(binding.value)));
|
|
1553
1553
|
},
|
|
@@ -1572,16 +1572,17 @@ const tooltipDirective = {
|
|
|
1572
1572
|
|
|
1573
1573
|
//#endregion
|
|
1574
1574
|
//#region src/plugin.ts
|
|
1575
|
-
const
|
|
1576
|
-
|
|
1577
|
-
|
|
1575
|
+
const vueltipPlugin = { install: (app, options) => {
|
|
1576
|
+
const { component, ...rest } = options;
|
|
1577
|
+
setOptions(rest);
|
|
1578
|
+
if (!component) return;
|
|
1578
1579
|
const container = document.createElement("div");
|
|
1579
1580
|
container.id = "__vueltip_root__";
|
|
1580
1581
|
document.body.appendChild(container);
|
|
1581
|
-
const tooltipApp = createApp(
|
|
1582
|
+
const tooltipApp = createApp(component);
|
|
1582
1583
|
tooltipApp._context = app._context;
|
|
1583
1584
|
tooltipApp.mount(container);
|
|
1584
1585
|
} };
|
|
1585
1586
|
|
|
1586
1587
|
//#endregion
|
|
1587
|
-
export {
|
|
1588
|
+
export { setOptions, useVueltip, vueltipDirective, vueltipPlugin };
|