vue-pointing-bubble 0.4.0 → 0.5.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 +4 -4
- package/dist/pointing-bubble/PointingBubble.vue.d.ts +1 -1
- package/dist/pointing-bubble/core.d.ts +2 -2
- package/dist/pointing-bubble/createBubbleController.d.ts +9 -4
- package/dist/pointing-bubble/measure.d.ts +11 -3
- package/dist/pointing-bubble/tail.d.ts +9 -2
- package/dist/pointing-bubble/types.d.ts +3 -0
- package/dist/vue-pointing-bubble.cjs +2 -2
- package/dist/vue-pointing-bubble.js +362 -303
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -48,20 +48,20 @@ const btn = ref<HTMLElement | null>(null)
|
|
|
48
48
|
| Prop | Default | Notes |
|
|
49
49
|
| --- | --- | --- |
|
|
50
50
|
| `target` | `null` | `{x,y}`, `Element`, CSS selector, or `null` (in-flow box only) |
|
|
51
|
-
| `placement` | `'auto'` | `'auto'` \| quadrant \| `'manual'` (CSS positions the box) |
|
|
51
|
+
| `placement` | `'auto'` | `'auto'` \| quadrant \| `'manual'` (CSS / host positions the **root** box) |
|
|
52
52
|
| `targetAnchor` | `'center'` | `'center'` \| `'edge'` for element targets |
|
|
53
53
|
| `maxWidth` | — | Wrap width (px) unless CSS sets width/max-width |
|
|
54
54
|
| `tailLength` | `45` | Tip → box offset (px) |
|
|
55
55
|
| `tailBaseWidth` | `24` | Tail width at the box (px) |
|
|
56
56
|
| `padding` | `8` | Via `--pb-padding` unless CSS sets padding |
|
|
57
|
-
| `shadow` | `true` |
|
|
57
|
+
| `shadow` | `true` | Drop-shadow on the root (includes the SVG tail) |
|
|
58
58
|
| `transitionDuration` | `200` | Glide ms (`0` off; respects reduced motion) |
|
|
59
59
|
|
|
60
60
|
Expose / ref: `update()` after non-reactive layout changes.
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
The component root is always the bubble chrome (`.pointing-bubble` + `.pointing-bubble__inner`). With a `target`, tip/tail use the nearest positioned ancestor as the coordinate frame; keep the bubble under that stage (avoid `overflow: hidden` between them). Free dragging / absolute CSS ⇒ `placement="manual"`; `auto` owns `left`/`top`.
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
CSS hooks: `.pointing-bubble`, `.pointing-bubble__inner`, `.pointing-bubble__svg`, `.pointing-bubble__path`. Vars: `--pb-padding`, `--pb-max-width`, `--pb-width`.
|
|
65
65
|
|
|
66
66
|
## License
|
|
67
67
|
|
|
@@ -2,12 +2,12 @@ export type { Placement, ResolvedPlacement, TargetAnchor, Point, BubbleTarget, F
|
|
|
2
2
|
export { DEFAULT_BUBBLE_CONFIG } from './types';
|
|
3
3
|
export { injectBubbleStyles, SHADOW } from './styles';
|
|
4
4
|
export { isPoint, resolveElement } from './resolveTarget';
|
|
5
|
-
export { sameKeys, measureFrame, measureBox } from './measure';
|
|
5
|
+
export { sameKeys, positioningFrameEl, measureFrame, measureFrameFrom, measureBox, } from './measure';
|
|
6
6
|
export { computeRoom, roomierSide, computeGeometry } from './geometry';
|
|
7
7
|
export type { ComputeGeometryOptions } from './geometry';
|
|
8
8
|
export { easeGeometry } from './ease';
|
|
9
9
|
export type { EaseHandle } from './ease';
|
|
10
10
|
export { buildTailPaths } from './tail';
|
|
11
11
|
export type { BuildTailOptions } from './tail';
|
|
12
|
-
export { createBubbleController } from './createBubbleController';
|
|
12
|
+
export { createBubbleController, isBubbleVisible, } from './createBubbleController';
|
|
13
13
|
export type { BubbleRenderState, BubbleControllerOptions, BubbleController, } from './createBubbleController';
|
|
@@ -5,10 +5,13 @@ export interface BubbleRenderState {
|
|
|
5
5
|
tip: Point | null;
|
|
6
6
|
/** Tip passed to slot/children (resolved geometry tip when available). */
|
|
7
7
|
slotTip: Point | null;
|
|
8
|
-
|
|
8
|
+
/** Applied to the component root (always the bubble chrome). */
|
|
9
9
|
boxStyle: StyleMap;
|
|
10
|
-
/**
|
|
11
|
-
|
|
10
|
+
/**
|
|
11
|
+
* SVG layer covering the positioning frame, offset so path coords stay
|
|
12
|
+
* frame-local. Empty when there is no tail.
|
|
13
|
+
*/
|
|
14
|
+
svgStyle: StyleMap;
|
|
12
15
|
tail: TailPaths | null;
|
|
13
16
|
boxFill: string;
|
|
14
17
|
boxStroke: string;
|
|
@@ -16,7 +19,7 @@ export interface BubbleRenderState {
|
|
|
16
19
|
boxZIndex: string;
|
|
17
20
|
}
|
|
18
21
|
export interface BubbleControllerOptions {
|
|
19
|
-
|
|
22
|
+
/** The bubble chrome element (component root). */
|
|
20
23
|
getBoxEl: () => HTMLElement | null;
|
|
21
24
|
onChange?: (state: BubbleRenderState) => void;
|
|
22
25
|
}
|
|
@@ -27,5 +30,7 @@ export interface BubbleController {
|
|
|
27
30
|
getState: () => BubbleRenderState;
|
|
28
31
|
destroy: () => void;
|
|
29
32
|
}
|
|
33
|
+
/** True when the bubble chrome is painted (not display/visibility/opacity hidden). */
|
|
34
|
+
export declare function isBubbleVisible(el: HTMLElement): boolean;
|
|
30
35
|
export declare function createBubbleController(options: BubbleControllerOptions): BubbleController;
|
|
31
36
|
export type { BubbleTarget };
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { BoxMeasure, FrameRect } from './types';
|
|
2
2
|
export declare function sameKeys(a: Record<string, unknown> | null | undefined, b: Record<string, unknown> | null | undefined): boolean;
|
|
3
|
-
/**
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Nearest positioned ancestor of `boxEl`, used as the tip/tail coordinate
|
|
5
|
+
* frame. Falls back to `document.documentElement`.
|
|
6
|
+
*/
|
|
7
|
+
export declare function positioningFrameEl(boxEl: HTMLElement): HTMLElement;
|
|
8
|
+
/** Measure a frame element including ancestor CSS scale (e.g. Slidev). */
|
|
9
|
+
export declare function measureFrame(frameEl: HTMLElement): FrameRect;
|
|
10
|
+
/** Frame for tip/tail math: the bubble's positioning containing block. */
|
|
11
|
+
export declare function measureFrameFrom(boxEl: HTMLElement): FrameRect;
|
|
12
|
+
/** Box size and top-left in frame-local coordinates. */
|
|
13
|
+
export declare function measureBox(boxEl: HTMLElement, frame: FrameRect): BoxMeasure;
|
|
@@ -6,7 +6,14 @@ export interface BuildTailOptions {
|
|
|
6
6
|
tailBaseWidth: number;
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
9
|
+
* Open wedge tail in frame space.
|
|
10
|
+
*
|
|
11
|
+
* The CSS box border stays as-is. SVG only draws the tip: short hooks that sit
|
|
12
|
+
* on the border band, then straight edges to the tip. SVG stroke is centred on
|
|
13
|
+
* the path, so the path runs down the middle of the border (depth −bw/2) and
|
|
14
|
+
* the stroke paints over the CSS border rather than into the content. Fill
|
|
15
|
+
* follows the same mouth→tip rays as the stroke (covering the border band via
|
|
16
|
+
* a short outer stub) so fill does not sit inside the stroke. No box outline
|
|
17
|
+
* is redrawn.
|
|
11
18
|
*/
|
|
12
19
|
export declare function buildTailPaths(opts: BuildTailOptions): TailPaths | null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const p=require("vue"),Z={target:null,placement:"auto",targetAnchor:"center",tailLength:45,tailBaseWidth:24,padding:8,shadow:!0,transitionDuration:200},U="pointing-bubble-styles",ot=`:where(.pointing-bubble__inner) {
|
|
2
2
|
box-sizing: border-box;
|
|
3
3
|
width: var(--pb-width, max-content);
|
|
4
4
|
max-width: var(--pb-max-width, none);
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
background: white;
|
|
7
7
|
border: 2px solid gray;
|
|
8
8
|
border-radius: 8px;
|
|
9
|
-
}`,_="drop-shadow(0 6px 8px rgba(0, 0, 0, 0.25))";function H(e=document){if(e.getElementById(T))return;const t=e.createElement("style");t.id=T,t.textContent=q,e.head.prepend(t)}function D(e){return typeof e=="object"&&e!==null&&typeof e.x=="number"&&typeof e.y=="number"&&e.nodeType!==1}function O(e){return typeof Element>"u"||e==null?null:typeof e=="string"?document.querySelector(e):e instanceof Element?e:null}function A(e,t){return!e||!t?!1:Object.keys(e).every(n=>e[n]===t[n])}function X(e){const t=e.getBoundingClientRect(),n=getComputedStyle(e),a=parseFloat(n.width)||0,l=parseFloat(n.height)||0;return{left:t.left,top:t.top,width:a,height:l,scaleX:a?t.width/a:1,scaleY:l?t.height/l:1,viewportWidth:window.innerWidth,viewportHeight:window.innerHeight}}function Z(e,t,n,a){const l=getComputedStyle(e),{scaleX:i,scaleY:d}=n,r=e.getBoundingClientRect(),f=t.getBoundingClientRect();return{x:a?(r.left-f.left)/i:0,y:a?(r.top-f.top)/d:0,width:r.width/i,height:r.height/d,fill:l.backgroundColor,stroke:l.borderTopColor,strokeWidth:parseFloat(l.borderTopWidth)||0,radius:l.borderTopLeftRadius,zIndex:l.zIndex}}function F(e,t,n){const a=e.x-n;let l=a,i=t.width?t.width-e.x-n:1/0;return t.viewportWidth&&(l=Math.min(l,t.left/t.scaleX+a),i=Math.min(i,(t.viewportWidth-t.left)/t.scaleX-e.x-n)),{left:Math.max(0,l),right:Math.max(0,i)}}function j(e){return e.left>e.right?"left":"right"}function N(e){const{tip:t,box:n,frame:a,placement:l,targetRect:i,room:d,tailLength:r}=e;if(!n.width||!n.height)return null;const{width:f,height:p}=n,{x:b,y}=t,k=l==="manual",o=e.targetAnchor==="edge"?i:null;if(k){if(o){const v=n.x+f/2,w=n.y+p/2;if(!(v>=o.left&&v<=o.right&&w>=o.top&&w<=o.bottom)){const x=Math.min(o.right,Math.max(o.left,v)),g=Math.min(o.bottom,Math.max(o.top,w));return{placement:"manual",tx:x,ty:g,bx:n.x,by:n.y,w:f,h:p}}}return{placement:"manual",tx:b,ty:y,bx:n.x,by:n.y,w:f,h:p}}const E=v=>o?v==="top"?o.top:o.bottom:y;let B=l;if(l==="auto"){let v=y>(a.height||600)/2?"top":"bottom",w=j(d);const{scaleX:u,scaleY:x}=a;if(a.viewportHeight){const g=a.top+(E("top")-p-r)*x>=0,S=a.top+(E("bottom")+p+r)*x<=a.viewportHeight;v==="top"&&!g&&S?v="bottom":v==="bottom"&&!S&&g&&(v="top")}if(a.viewportWidth){const g=a.left+(b-f-r)*u>=0,S=a.left+(b+f+r)*u<=a.viewportWidth;w==="left"&&!g&&S?w="right":w==="right"&&!S&&g&&(w="left")}B=`${v}-${w}`}const[W,C]=B.split("-"),I=E(W);return{placement:B,tx:b,ty:I,bx:C==="left"?b-f-r:b+r,by:W==="top"?I-p-r:I+r,w:f,h:p}}const G=["tx","ty","bx","by"],V=["tx","ty"];function K(){return typeof matchMedia<"u"&&matchMedia("(prefers-reduced-motion: reduce)").matches}function Q(e,t,n,a){let l=0;const i=()=>{typeof cancelAnimationFrame<"u"&&cancelAnimationFrame(l)};if(!t||!e||n<=0||typeof requestAnimationFrame>"u"||K())return a(t),{cancel:i};const d=performance.now(),r=f=>{const p=Math.min(1,(f-d)/n),b=1-Math.pow(1-p,3),y={...t},k=t.placement==="manual"?V:G;for(const o of k)y[o]=e[o]+(t[o]-e[o])*b;a(y),p<1&&(l=requestAnimationFrame(r))};return l=requestAnimationFrame(r),{cancel:i}}function Y(e){const{geometry:t,strokeWidth:n,radius:a,tailBaseWidth:l}=e,{placement:i,tx:d,ty:r,bx:f,by:p,w:b,h:y}=t,k=parseFloat(a)*(a.endsWith("%")?Math.min(b,y)/100:1)||0,o=l/2,E=(s,c,h)=>c>h?(c+h)/2:Math.min(h,Math.max(c,s));let B=null,W=0;if(i==="manual"){const s=Math.max(f-d,d-(f+b),0),c=Math.max(p-r,r-(p+y),0);if(s>0&&s>=c)B=d<f?"left":"right",W=r;else if(c>0)B=r<p?"top":"bottom",W=d;else return null}else if(i!=="none"){const[s,c]=i.split("-");B=c==="left"?"right":"left",W=p+y*(s==="top"?.65:.35)}else return null;const C=1,I=B==="top"||B==="bottom",v={left:(s,c)=>[f-c,s],right:(s,c)=>[f+b+c,s],top:(s,c)=>[s,p-c],bottom:(s,c)=>[s,p+y+c]}[B],w={left:f-d,right:d-f-b,top:p-r,bottom:r-p-y}[B],u=I?E(W,f+k+o+n/2,f+b-k-o-n/2):E(W,p+k+o+n/2,p+y-k-o-n/2),x=Math.max(0,Math.min(n,w/2)),g=([s,c])=>`${s} ${c}`,S=(s,c)=>{const h=v(s,x),$=Math.hypot(d-h[0],r-h[1])||1,R=[h[0]+(d-h[0])*x/$,h[1]+(r-h[1])*x/$];return{inner:g(v(s,c)),outer:g(v(s,0)),ctrl:g(h),end:g(R)}},M=s=>{const c=S(u-o,s),h=S(u+o,s);return`M ${c.inner} L ${c.outer} Q ${c.ctrl} ${c.end} L ${d} ${r} L ${h.end} Q ${h.ctrl} ${h.outer} L ${h.inner}`};return{fill:`${M(-n-C)} Z`,stroke:n?M(-n):null}}function J(e){return{hasTarget:e,placement:"none",tip:null,slotTip:null,overlayStyle:{},boxStyle:{},rootIsBox:!e,tail:null,boxFill:"",boxStroke:"",boxStrokeWidth:0,boxZIndex:"auto"}}function z(e,t){return e===t?!0:!e||!t?!1:e.x===t.x&&e.y===t.y}function tt(e,t){return e.hasTarget===t.hasTarget&&e.placement===t.placement&&e.rootIsBox===t.rootIsBox&&e.boxFill===t.boxFill&&e.boxStroke===t.boxStroke&&e.boxStrokeWidth===t.boxStrokeWidth&&e.boxZIndex===t.boxZIndex&&z(e.tip,t.tip)&&z(e.slotTip,t.slotTip)&&A(e.overlayStyle,t.overlayStyle)&&A(e.boxStyle,t.boxStyle)&&e.tail?.fill===t.tail?.fill&&e.tail?.stroke===t.tail?.stroke}function U(e){H();let t={...P},n=null,a=null,l=null,i={left:0,top:0,width:0,height:0,scaleX:1,scaleY:1,viewportWidth:0,viewportHeight:0},d=null,r=null,f=null,p=null,b=J(!1);const y=()=>{const u=k();tt(b,u)||(b=u,e.onChange?.(b))};function k(){const u=t.target!=null,x=t.placement==="manual",g=u?d?.placement??"none":"none",S={position:"absolute",inset:"0",pointerEvents:"none",filter:t.shadow?_:void 0},M=l?.zIndex;M&&M!=="auto"&&(S.zIndex=M);const s={"--pb-padding":typeof t.padding=="number"?`${t.padding}px`:t.padding};if(t.maxWidth!=null&&(s["--pb-max-width"]=`${t.maxWidth}px`),!u)s["--pb-width"]="fit-content",t.shadow&&(s.filter=_);else if(Object.assign(s,{position:"absolute",pointerEvents:"auto",visibility:d?"visible":"hidden"}),x)s["--pb-width"]="fit-content";else if(Object.assign(s,{left:`${d?.bx??0}px`,top:`${d?.by??0}px`,margin:"0"}),t.maxWidth==null&&n){const h=F(n,i,t.tailLength),$=r?.placement??t.placement,R=$==="auto"?j(h):$.split("-")[1];s["--pb-max-width"]=`${h[R]}px`}const c=u&&d&&l?Y({geometry:d,strokeWidth:l.strokeWidth,radius:l.radius,tailBaseWidth:t.tailBaseWidth}):null;return{hasTarget:u,placement:g,tip:n,slotTip:r?{x:r.tx,y:r.ty}:n,overlayStyle:S,boxStyle:s,rootIsBox:!u,tail:c,boxFill:l?.fill??"",boxStroke:l?.stroke??"",boxStrokeWidth:l?.strokeWidth??0,boxZIndex:l?.zIndex??"auto"}}function o(){if(!n||!l){r=null,E(null);return}const u=F(n,i,t.tailLength);r=N({tip:n,box:l,frame:i,placement:t.placement,targetAnchor:t.targetAnchor,targetRect:a,room:u,tailLength:t.tailLength}),E(r)}function E(u){f?.cancel(),f=Q(d,u,t.transitionDuration,x=>{d=x,y()})}function B(){const u=e.getRootEl(),x=e.getBoxEl();if(!x||t.target==null||!u)return;const g=Z(x,u,i,t.placement==="manual");A(g,l)||(l=g)}function W(){const u=e.getRootEl();if(t.target==null||!u){n=null,a=null,l=null,r=null,d=null,y();return}i=X(u);const x=O(t.target);if(x){const g=x.getBoundingClientRect(),{scaleX:S,scaleY:M,left:s,top:c}=i,h={left:(g.left-s)/S,top:(g.top-c)/M,right:(g.right-s)/S,bottom:(g.bottom-c)/M};A(h,a)||(a=h),n={x:(h.left+h.right)/2,y:(h.top+h.bottom)/2}}else if(D(t.target))a=null,n={x:t.target.x,y:t.target.y};else{a=null,n=null,l=null,r=null,d=null,y();return}B(),o()}function C(){W()}typeof window<"u"&&(window.addEventListener("resize",C),window.addEventListener("scroll",C,!0));function I(){if(typeof ResizeObserver>"u")return;p?.disconnect(),p=new ResizeObserver(()=>W());const u=e.getRootEl(),x=e.getBoxEl();u&&p.observe(u),x&&p.observe(x)}const v=W;function w(){I(),v()}return{update:w,setConfig(u){t={...t,...u},w()},getConfig:()=>t,getState:()=>b,destroy(){f?.cancel(),p?.disconnect(),typeof window<"u"&&(window.removeEventListener("resize",C),window.removeEventListener("scroll",C,!0))}}}const et=["data-placement"],nt=["d","fill"],ot=["d","stroke","stroke-width"],L=m.defineComponent({name:"PointingBubble",inheritAttrs:!1,__name:"PointingBubble",props:{target:{default:null},placement:{default:"auto"},targetAnchor:{default:"center"},maxWidth:{default:void 0},tailLength:{default:45},tailBaseWidth:{default:24},padding:{default:8},shadow:{type:Boolean,default:!0},transitionDuration:{default:200}},setup(e,{expose:t}){const n=e,a=m.ref(null),l=m.ref(null),i=m.ref({hasTarget:!1,placement:"none",tip:null,slotTip:null,overlayStyle:{},boxStyle:{},rootIsBox:!0,tail:null,boxFill:"",boxStroke:"",boxStrokeWidth:0,boxZIndex:"auto"});function d(o){return o==null?null:typeof o=="string"||typeof Element<"u"&&o instanceof Element?o:typeof o=="object"&&"$el"in o&&o.$el instanceof Element?o.$el:typeof o=="object"&&typeof o.x=="number"&&typeof o.y=="number"?o:null}const r=U({getRootEl:()=>a.value,getBoxEl:()=>l.value,onChange:o=>{i.value=o}});function f(){r.setConfig({target:d(n.target),placement:n.placement,targetAnchor:n.targetAnchor,maxWidth:n.maxWidth,tailLength:n.tailLength,tailBaseWidth:n.tailBaseWidth,padding:n.padding,shadow:n.shadow,transitionDuration:n.transitionDuration})}m.watch(()=>[n.target,typeof n.target=="object"&&n.target&&"x"in n.target?n.target.x:null,typeof n.target=="object"&&n.target&&"y"in n.target?n.target.y:null,n.placement,n.targetAnchor,n.maxWidth,n.tailLength,n.tailBaseWidth,n.padding,n.shadow,n.transitionDuration],f,{flush:"post"}),m.onMounted(()=>{f()}),m.onBeforeUnmount(()=>{r.destroy()});function p(){r.update()}t({update:p});const b=m.computed(()=>i.value.rootIsBox?i.value.boxStyle:i.value.overlayStyle),y=m.computed(()=>i.value.rootIsBox?{display:"contents"}:i.value.boxStyle),k=m.computed(()=>({position:"absolute",inset:"0",width:"100%",height:"100%",overflow:"visible",zIndex:i.value.boxZIndex}));return(o,E)=>(m.openBlock(),m.createElementBlock("div",m.mergeProps({ref_key:"rootRef",ref:a,class:["pointing-bubble",{"pointing-bubble__inner":!e.target}],"data-placement":i.value.placement},e.target?{}:o.$attrs,{style:b.value}),[m.createElementVNode("div",m.mergeProps({ref_key:"boxRef",ref:l,class:{"pointing-bubble__inner":!!e.target}},e.target?o.$attrs:{},{style:y.value}),[m.renderSlot(o.$slots,"default",{placement:i.value.placement,tip:i.value.slotTip},()=>[E[0]||(E[0]=m.createElementVNode("p",{style:{margin:0,fontSize:"14px",fontWeight:600,color:"#1e293b"}}," Callout content ",-1))])],16),e.target&&i.value.tail?(m.openBlock(),m.createElementBlock("svg",{key:0,class:"pointing-bubble__svg",style:m.normalizeStyle(k.value)},[m.createElementVNode("path",{class:"pointing-bubble__path",d:i.value.tail.fill,fill:i.value.boxFill},null,8,nt),i.value.tail.stroke?(m.openBlock(),m.createElementBlock("path",{key:0,class:"pointing-bubble__path",d:i.value.tail.stroke,fill:"none",stroke:i.value.boxStroke,"stroke-width":i.value.boxStrokeWidth,"stroke-linejoin":"round","stroke-linecap":"butt"},null,8,ot)):m.createCommentVNode("",!0)],4)):m.createCommentVNode("",!0)],16,et))}}),lt={install(e,t={}){const n=t.name??"PointingBubble";e.component(n,L),e.component("Callout",L)}};exports.Callout=L;exports.DEFAULT_BUBBLE_CONFIG=P;exports.PointingBubble=L;exports.PointingBubblePlugin=lt;exports.buildTailPaths=Y;exports.computeGeometry=N;exports.createBubbleController=U;exports.default=L;exports.isPoint=D;exports.resolveElement=O;
|
|
9
|
+
}`,lt="drop-shadow(0 6px 8px rgba(0, 0, 0, 0.25))";function it(e=document){if(e.getElementById(U))return;const t=e.createElement("style");t.id=U,t.textContent=ot,e.head.prepend(t)}function K(e){return typeof e=="object"&&e!==null&&typeof e.x=="number"&&typeof e.y=="number"&&e.nodeType!==1}function q(e){return typeof Element>"u"||e==null?null:typeof e=="string"?document.querySelector(e):e instanceof Element?e:null}function Y(e,t){return!e||!t?!1:Object.keys(e).every(n=>e[n]===t[n])}function J(e){let t=e.parentElement;for(;t;){const n=getComputedStyle(t).position;if(n&&n!=="static")return t;if(t===document.documentElement)break;t=t.parentElement}return document.documentElement}function rt(e){const t=e.getBoundingClientRect(),n=getComputedStyle(e),l=parseFloat(n.width)||0,o=parseFloat(n.height)||0;return{left:t.left,top:t.top,width:l,height:o,scaleX:l?t.width/l:1,scaleY:o?t.height/o:1,viewportWidth:window.innerWidth,viewportHeight:window.innerHeight}}function st(e){return rt(J(e))}function at(e,t){const n=getComputedStyle(e),{scaleX:l,scaleY:o,left:u,top:a}=t,i=e.getBoundingClientRect();return{x:(i.left-u)/l,y:(i.top-a)/o,width:i.width/l,height:i.height/o,fill:n.backgroundColor,stroke:n.borderTopColor,strokeWidth:parseFloat(n.borderTopWidth)||0,borderLeft:(parseFloat(n.borderLeftWidth)||0)/l,borderTop:(parseFloat(n.borderTopWidth)||0)/o,radius:n.borderTopLeftRadius,zIndex:n.zIndex}}function V(e,t,n){const l=e.x-n;let o=l,u=t.width?t.width-e.x-n:1/0;return t.viewportWidth&&(o=Math.min(o,t.left/t.scaleX+l),u=Math.min(u,(t.viewportWidth-t.left)/t.scaleX-e.x-n)),{left:Math.max(0,o),right:Math.max(0,u)}}function Q(e){return e.left>e.right?"left":"right"}function tt(e){const{tip:t,box:n,frame:l,placement:o,targetRect:u,room:a,tailLength:i}=e;if(!n.width||!n.height)return null;const{width:r,height:f}=n,{x:h,y:g}=t,E=o==="manual",c=e.targetAnchor==="edge"?u:null;if(E){if(c){const k=n.x+r/2,B=n.y+f/2;if(!(k>=c.left&&k<=c.right&&B>=c.top&&B<=c.bottom)){const b=Math.min(c.right,Math.max(c.left,k)),W=Math.min(c.bottom,Math.max(c.top,B));return{placement:"manual",tx:b,ty:W,bx:n.x,by:n.y,w:r,h:f}}}return{placement:"manual",tx:h,ty:g,bx:n.x,by:n.y,w:r,h:f}}const _=k=>c?k==="top"?c.top:c.bottom:g;let w=o;if(o==="auto"){let k=g>(l.height||600)/2?"top":"bottom",B=Q(a);const{scaleX:$,scaleY:b}=l;if(l.viewportHeight){const W=l.top+(_("top")-f-i)*b>=0,A=l.top+(_("bottom")+f+i)*b<=l.viewportHeight;k==="top"&&!W&&A?k="bottom":k==="bottom"&&!A&&W&&(k="top")}if(l.viewportWidth){const W=l.left+(h-r-i)*$>=0,A=l.left+(h+r+i)*$<=l.viewportWidth;B==="left"&&!W&&A?B="right":B==="right"&&!A&&W&&(B="left")}w=`${k}-${B}`}const[d,T]=w.split("-"),v=_(d);return{placement:w,tx:h,ty:v,bx:T==="left"?h-r-i:h+i,by:d==="top"?v-f-i:v+i,w:r,h:f}}const ct=["tx","ty","bx","by"],ut=["tx","ty"];function dt(){return typeof matchMedia<"u"&&matchMedia("(prefers-reduced-motion: reduce)").matches}function ft(e,t,n,l){let o=0;const u=()=>{typeof cancelAnimationFrame<"u"&&cancelAnimationFrame(o)};if(!t||!e||n<=0||typeof requestAnimationFrame>"u"||dt())return l(t),{cancel:u};const a=performance.now(),i=r=>{const f=Math.min(1,(r-a)/n),h=1-Math.pow(1-f,3),g={...t},E=t.placement==="manual"?ut:ct;for(const c of E)g[c]=e[c]+(t[c]-e[c])*h;l(g),f<1&&(o=requestAnimationFrame(i))};return o=requestAnimationFrame(i),{cancel:u}}function et(e){const{geometry:t,strokeWidth:n,radius:l,tailBaseWidth:o}=e,{placement:u,tx:a,ty:i,bx:r,by:f,w:h,h:g}=t,E=parseFloat(l)*(l.endsWith("%")?Math.min(h,g)/100:1)||0,c=o/2,_=(y,m,P)=>m>P?(m+P)/2:Math.min(P,Math.max(m,y));let w=null,d=0;if(u==="manual"){const y=Math.max(r-a,a-(r+h),0),m=Math.max(f-i,i-(f+g),0);if(y>0&&y>=m)w=a<r?"left":"right",d=i;else if(m>0)w=i<f?"top":"bottom",d=a;else return null}else if(u!=="none"){const[y,m]=u.split("-");w=m==="left"?"right":"left",d=f+g*(y==="top"?.65:.35)}else return null;const T=w==="top"||w==="bottom",v={left:(y,m)=>[r-m,y],right:(y,m)=>[r+h+m,y],top:(y,m)=>[y,f-m],bottom:(y,m)=>[y,f+g+m]}[w],k=T?r:f,B=T?r+h:f+g,$=_(d,k+c+n/2+E,B-c-n/2-E),b=([y,m])=>`${y} ${m}`,W=n>0?-n/2:0,A=2,j=2,s=$-c,x=$+c,z=v(s-A,W),S=v(s,W),C=v(x,W),M=v(x+A,W),F=v(s,-(n+j)),O=v(x,-(n+j)),L=v(s,1),I=v(x,1);return{fill:`M ${b(F)} L ${b(L)} L ${b(S)} L ${a} ${i} L ${b(C)} L ${b(I)} L ${b(O)} Z`,stroke:n?`M ${b(z)} L ${b(S)} L ${a} ${i} L ${b(C)} L ${b(M)}`:null}}const pt=["left","top","right","bottom","width","height","transform","translate","inset","inset-inline","inset-block"];function ht(e){return{hasTarget:e,placement:"none",tip:null,slotTip:null,boxStyle:{},svgStyle:{},tail:null,boxFill:"",boxStroke:"",boxStrokeWidth:0,boxZIndex:"auto"}}function N(e,t){return e===t?!0:!e||!t?!1:e.x===t.x&&e.y===t.y}function mt(e,t){return e===t?!0:!e||!t?!1:e.placement===t.placement&&e.tx===t.tx&&e.ty===t.ty&&e.bx===t.bx&&e.by===t.by&&e.w===t.w&&e.h===t.h}function gt(e,t){return e.hasTarget===t.hasTarget&&e.placement===t.placement&&e.boxFill===t.boxFill&&e.boxStroke===t.boxStroke&&e.boxStrokeWidth===t.boxStrokeWidth&&e.boxZIndex===t.boxZIndex&&N(e.tip,t.tip)&&N(e.slotTip,t.slotTip)&&Y(e.boxStyle,t.boxStyle)&&Y(e.svgStyle,t.svgStyle)&&e.tail?.fill===t.tail?.fill&&e.tail?.stroke===t.tail?.stroke}function X(e){if(typeof e.checkVisibility=="function")return e.checkVisibility({checkOpacity:!0,checkVisibilityCSS:!0});const t=getComputedStyle(e);return!(t.display==="none"||t.visibility==="hidden"||parseFloat(t.opacity)===0)}function G(e){const t=e.style;return pt.map(n=>t.getPropertyValue(n)).join("|")}function nt(e){it();let t={...Z},n=null,l=null,o=null,u={left:0,top:0,width:0,height:0,scaleX:1,scaleY:1,viewportWidth:0,viewportHeight:0},a=null,i=null,r=null,f=null,h=null,g=null,E=ht(!1),c=!1,_="";const w=()=>{const s=d();gt(E,s)||(E=s,e.onChange?.(E))};function d(){const s=t.target!=null,x=t.placement==="manual",z=s?a?.placement??"none":"none",S={"--pb-padding":typeof t.padding=="number"?`${t.padding}px`:t.padding};if(t.maxWidth!=null&&(S["--pb-max-width"]=`${t.maxWidth}px`),t.shadow&&(S.filter=lt),!s)S["--pb-width"]="fit-content";else if(Object.assign(S,{position:"absolute",pointerEvents:"auto",overflow:"visible"}),x)S["--pb-width"]="fit-content";else if(Object.assign(S,{left:`${a?.bx??0}px`,top:`${a?.by??0}px`,margin:"0"}),t.maxWidth==null&&n){const O=V(n,u,t.tailLength),L=i?.placement??t.placement,I=L==="auto"?Q(O):L.split("-")[1];S["--pb-max-width"]=`${O[I]}px`}const C=o?.zIndex;C&&C!=="auto"&&(S.zIndex=C);const M=s&&a&&o?et({geometry:a,strokeWidth:o.strokeWidth,radius:o.radius,tailBaseWidth:t.tailBaseWidth}):null;let F={};if(M&&a&&u.width&&u.height){const O=o?.borderLeft??0,L=o?.borderTop??0;F={position:"absolute",left:`${-a.bx-O}px`,top:`${-a.by-L}px`,width:`${u.width}px`,height:`${u.height}px`,overflow:"visible",pointerEvents:"none",zIndex:o?.zIndex??"auto"}}return{hasTarget:s,placement:z,tip:n,slotTip:i?{x:i.tx,y:i.ty}:n,boxStyle:S,svgStyle:F,tail:M,boxFill:o?.fill??"",boxStroke:o?.stroke??"",boxStrokeWidth:o?.strokeWidth??0,boxZIndex:o?.zIndex??"auto"}}function T(){if(!n||!o){(i!==null||a!==null)&&(i=null,v(null));return}const s=V(n,u,t.tailLength),x=tt({tip:n,box:o,frame:u,placement:t.placement,targetAnchor:t.targetAnchor,targetRect:l,room:s,tailLength:t.tailLength});mt(i,x)||(i=x,v(i))}function v(s){r?.cancel(),r=ft(a,s,t.transitionDuration,x=>{a=x,w()})}function k(s){const x=at(s,u);return Y(x,o)?!1:(o=x,!0)}function B(){const s=e.getBoxEl();if(!s){n=null,l=null,o=null,i=null,a=null,c=!1,w();return}if(!X(s)){r?.cancel(),c=!0;return}const x=c;if(c=!1,t.target==null){n=null,l=null,o=null,i=null,a=null,w();return}const z=u;u=st(s);const S=!Y(u,z),C=typeof t.target=="string"?J(s).querySelector(t.target)??q(t.target):q(t.target);let M=!1,F=!1;if(C){const L=C.getBoundingClientRect(),{scaleX:I,scaleY:y,left:m,top:P}=u,R={left:(L.left-m)/I,top:(L.top-P)/y,right:(L.right-m)/I,bottom:(L.bottom-P)/y};F=!Y(R,l),F&&(l=R);const H={x:(R.left+R.right)/2,y:(R.top+R.bottom)/2};M=!N(n,H),n=H}else if(K(t.target)){F=l!=null,l=null;const L={x:t.target.x,y:t.target.y};M=!N(n,L),n=L}else{n=null,l=null,o=null,i=null,a=null,w();return}const O=k(s);_=G(s),!(!x&&!S&&!M&&!F&&!O&&a)&&T()}function $(){B()}typeof window<"u"&&(window.addEventListener("resize",$),window.addEventListener("scroll",$,!0));const b=B;function W(s){const x=e.getBoxEl();if(!x)return;if(s.some(C=>C.attributeName==="class"||C.attributeName==="hidden")){if(!X(x)){r?.cancel(),c=!0;return}b();return}const S=G(x);S!==_&&(_=S,b())}function A(){const s=e.getBoxEl();s!==g&&(g=s,f?.disconnect(),h?.disconnect(),f=null,h=null,s&&(typeof ResizeObserver<"u"&&(f=new ResizeObserver(()=>b()),f.observe(s)),typeof MutationObserver<"u"&&(h=new MutationObserver(W),h.observe(s,{attributes:!0,attributeFilter:["style","class","hidden"]}))))}function j(){A(),b()}return{update:j,setConfig(s){t={...t,...s},j()},getConfig:()=>t,getState:()=>E,destroy(){r?.cancel(),f?.disconnect(),h?.disconnect(),g=null,typeof window<"u"&&(window.removeEventListener("resize",$),window.removeEventListener("scroll",$,!0))}}}const bt=["data-placement"],xt=["d","fill"],yt=["d","stroke","stroke-width"],D=p.defineComponent({name:"PointingBubble",inheritAttrs:!1,__name:"PointingBubble",props:{target:{default:null},placement:{default:"auto"},targetAnchor:{default:"center"},maxWidth:{default:void 0},tailLength:{default:45},tailBaseWidth:{default:24},padding:{default:8},shadow:{type:Boolean,default:!0},transitionDuration:{default:200}},setup(e,{expose:t}){const n=e,l=p.useAttrs(),o=p.computed(()=>l.class),u=p.computed(()=>l.style),a=p.computed(()=>{const{class:d,style:T,...v}=l;return v}),i=p.ref(null),r=p.reactive({hasTarget:!1,placement:"none",tip:null,slotTip:null,boxStyle:{},svgStyle:{},tail:null,boxFill:"",boxStroke:"",boxStrokeWidth:0,boxZIndex:"auto"});function f(d){return d==null?null:typeof d=="string"||typeof Element<"u"&&d instanceof Element?d:typeof d=="object"&&"$el"in d&&d.$el instanceof Element?d.$el:typeof d=="object"&&typeof d.x=="number"&&typeof d.y=="number"?d:null}const h=p.getCurrentInstance(),g=nt({getBoxEl:()=>i.value,onChange:d=>{Object.assign(r,d),h?.update()}});function E(){g.setConfig({target:f(n.target),placement:n.placement,targetAnchor:n.targetAnchor,maxWidth:n.maxWidth,tailLength:n.tailLength,tailBaseWidth:n.tailBaseWidth,padding:n.padding,shadow:n.shadow,transitionDuration:n.transitionDuration})}p.watch(()=>[n.target,typeof n.target=="object"&&n.target&&"x"in n.target?n.target.x:null,typeof n.target=="object"&&n.target&&"y"in n.target?n.target.y:null,n.placement,n.targetAnchor,n.maxWidth,n.tailLength,n.tailBaseWidth,n.padding,n.shadow,n.transitionDuration],E,{flush:"post"}),p.onMounted(()=>{E()}),p.onBeforeUnmount(()=>{g.destroy()});function c(){g.update()}t({update:c});const _=p.computed(()=>({...u.value,...r.boxStyle})),w=p.computed(()=>r.svgStyle);return(d,T)=>(p.openBlock(),p.createElementBlock("div",p.mergeProps({ref_key:"rootRef",ref:i,class:["pointing-bubble","pointing-bubble__inner",o.value],"data-placement":r.placement},a.value,{style:_.value}),[p.renderSlot(d.$slots,"default",{placement:r.placement,tip:r.slotTip},()=>[T[0]||(T[0]=p.createElementVNode("p",{style:{margin:0,fontSize:"14px",fontWeight:600,color:"#1e293b"}}," Callout content ",-1))]),e.target&&r.tail?(p.openBlock(),p.createElementBlock("svg",{key:0,class:"pointing-bubble__svg",style:p.normalizeStyle(w.value)},[p.createElementVNode("path",{class:"pointing-bubble__path",d:r.tail.fill,fill:r.boxFill},null,8,xt),r.tail.stroke?(p.openBlock(),p.createElementBlock("path",{key:0,class:"pointing-bubble__path",d:r.tail.stroke,fill:"none",stroke:r.boxStroke,"stroke-width":r.boxStrokeWidth,"stroke-linejoin":"round","stroke-linecap":"butt"},null,8,yt)):p.createCommentVNode("",!0)],4)):p.createCommentVNode("",!0)],16,bt))}}),wt={install(e,t={}){const n=t.name??"PointingBubble";e.component(n,D),e.component("Callout",D)}};exports.Callout=D;exports.DEFAULT_BUBBLE_CONFIG=Z;exports.PointingBubble=D;exports.PointingBubblePlugin=wt;exports.buildTailPaths=et;exports.computeGeometry=tt;exports.createBubbleController=nt;exports.default=D;exports.isPoint=K;exports.resolveElement=q;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
const
|
|
1
|
+
import { defineComponent as nt, useAttrs as ot, computed as Y, ref as it, reactive as lt, getCurrentInstance as rt, watch as st, onMounted as at, onBeforeUnmount as ct, openBlock as H, createElementBlock as q, mergeProps as ut, renderSlot as dt, createElementVNode as X, normalizeStyle as ft, createCommentVNode as U } from "vue";
|
|
2
|
+
const pt = {
|
|
3
3
|
target: null,
|
|
4
4
|
placement: "auto",
|
|
5
5
|
targetAnchor: "center",
|
|
@@ -8,7 +8,7 @@ const Q = {
|
|
|
8
8
|
padding: 8,
|
|
9
9
|
shadow: !0,
|
|
10
10
|
transitionDuration: 200
|
|
11
|
-
},
|
|
11
|
+
}, V = "pointing-bubble-styles", ht = `:where(.pointing-bubble__inner) {
|
|
12
12
|
box-sizing: border-box;
|
|
13
13
|
width: var(--pb-width, max-content);
|
|
14
14
|
max-width: var(--pb-max-width, none);
|
|
@@ -16,173 +16,187 @@ const Q = {
|
|
|
16
16
|
background: white;
|
|
17
17
|
border: 2px solid gray;
|
|
18
18
|
border-radius: 8px;
|
|
19
|
-
}`,
|
|
20
|
-
function
|
|
21
|
-
if (e.getElementById(
|
|
19
|
+
}`, mt = "drop-shadow(0 6px 8px rgba(0, 0, 0, 0.25))";
|
|
20
|
+
function gt(e = document) {
|
|
21
|
+
if (e.getElementById(V)) return;
|
|
22
22
|
const t = e.createElement("style");
|
|
23
|
-
t.id =
|
|
23
|
+
t.id = V, t.textContent = ht, e.head.prepend(t);
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function bt(e) {
|
|
26
26
|
return typeof e == "object" && e !== null && typeof e.x == "number" && typeof e.y == "number" && e.nodeType !== 1;
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function Z(e) {
|
|
29
29
|
return typeof Element > "u" || e == null ? null : typeof e == "string" ? document.querySelector(e) : e instanceof Element ? e : null;
|
|
30
30
|
}
|
|
31
|
-
function
|
|
31
|
+
function j(e, t) {
|
|
32
32
|
return !e || !t ? !1 : Object.keys(e).every((n) => e[n] === t[n]);
|
|
33
33
|
}
|
|
34
|
-
function
|
|
35
|
-
|
|
34
|
+
function tt(e) {
|
|
35
|
+
let t = e.parentElement;
|
|
36
|
+
for (; t; ) {
|
|
37
|
+
const n = getComputedStyle(t).position;
|
|
38
|
+
if (n && n !== "static") return t;
|
|
39
|
+
if (t === document.documentElement) break;
|
|
40
|
+
t = t.parentElement;
|
|
41
|
+
}
|
|
42
|
+
return document.documentElement;
|
|
43
|
+
}
|
|
44
|
+
function xt(e) {
|
|
45
|
+
const t = e.getBoundingClientRect(), n = getComputedStyle(e), i = parseFloat(n.width) || 0, o = parseFloat(n.height) || 0;
|
|
36
46
|
return {
|
|
37
47
|
left: t.left,
|
|
38
48
|
top: t.top,
|
|
39
|
-
width:
|
|
40
|
-
height:
|
|
41
|
-
scaleX:
|
|
42
|
-
scaleY:
|
|
49
|
+
width: i,
|
|
50
|
+
height: o,
|
|
51
|
+
scaleX: i ? t.width / i : 1,
|
|
52
|
+
scaleY: o ? t.height / o : 1,
|
|
43
53
|
viewportWidth: window.innerWidth,
|
|
44
54
|
viewportHeight: window.innerHeight
|
|
45
55
|
};
|
|
46
56
|
}
|
|
47
|
-
function
|
|
48
|
-
|
|
57
|
+
function yt(e) {
|
|
58
|
+
return xt(tt(e));
|
|
59
|
+
}
|
|
60
|
+
function wt(e, t) {
|
|
61
|
+
const n = getComputedStyle(e), { scaleX: i, scaleY: o, left: u, top: a } = t, l = e.getBoundingClientRect();
|
|
49
62
|
return {
|
|
50
|
-
x:
|
|
51
|
-
y:
|
|
52
|
-
width:
|
|
53
|
-
height:
|
|
54
|
-
fill:
|
|
55
|
-
stroke:
|
|
56
|
-
strokeWidth: parseFloat(
|
|
57
|
-
|
|
58
|
-
|
|
63
|
+
x: (l.left - u) / i,
|
|
64
|
+
y: (l.top - a) / o,
|
|
65
|
+
width: l.width / i,
|
|
66
|
+
height: l.height / o,
|
|
67
|
+
fill: n.backgroundColor,
|
|
68
|
+
stroke: n.borderTopColor,
|
|
69
|
+
strokeWidth: parseFloat(n.borderTopWidth) || 0,
|
|
70
|
+
// Abspos SVG is positioned against the padding edge; path math uses the
|
|
71
|
+
// border box from getBoundingClientRect — subtract these when offsetting.
|
|
72
|
+
borderLeft: (parseFloat(n.borderLeftWidth) || 0) / i,
|
|
73
|
+
borderTop: (parseFloat(n.borderTopWidth) || 0) / o,
|
|
74
|
+
radius: n.borderTopLeftRadius,
|
|
75
|
+
zIndex: n.zIndex
|
|
59
76
|
};
|
|
60
77
|
}
|
|
61
|
-
function
|
|
62
|
-
const
|
|
63
|
-
let
|
|
64
|
-
return t.viewportWidth && (
|
|
65
|
-
|
|
78
|
+
function G(e, t, n) {
|
|
79
|
+
const i = e.x - n;
|
|
80
|
+
let o = i, u = t.width ? t.width - e.x - n : 1 / 0;
|
|
81
|
+
return t.viewportWidth && (o = Math.min(o, t.left / t.scaleX + i), u = Math.min(
|
|
82
|
+
u,
|
|
66
83
|
(t.viewportWidth - t.left) / t.scaleX - e.x - n
|
|
67
|
-
)), { left: Math.max(0,
|
|
84
|
+
)), { left: Math.max(0, o), right: Math.max(0, u) };
|
|
68
85
|
}
|
|
69
|
-
function
|
|
86
|
+
function et(e) {
|
|
70
87
|
return e.left > e.right ? "left" : "right";
|
|
71
88
|
}
|
|
72
|
-
function
|
|
73
|
-
const { tip: t, box: n, frame:
|
|
89
|
+
function vt(e) {
|
|
90
|
+
const { tip: t, box: n, frame: i, placement: o, targetRect: u, room: a, tailLength: l } = e;
|
|
74
91
|
if (!n.width || !n.height) return null;
|
|
75
|
-
const { width:
|
|
92
|
+
const { width: r, height: f } = n, { x: p, y: m } = t, k = o === "manual", c = e.targetAnchor === "edge" ? u : null;
|
|
76
93
|
if (k) {
|
|
77
|
-
if (
|
|
78
|
-
const
|
|
79
|
-
if (!(
|
|
80
|
-
const
|
|
81
|
-
return { placement: "manual", tx:
|
|
94
|
+
if (c) {
|
|
95
|
+
const S = n.x + r / 2, W = n.y + f / 2;
|
|
96
|
+
if (!(S >= c.left && S <= c.right && W >= c.top && W <= c.bottom)) {
|
|
97
|
+
const g = Math.min(c.right, Math.max(c.left, S)), E = Math.min(c.bottom, Math.max(c.top, W));
|
|
98
|
+
return { placement: "manual", tx: g, ty: E, bx: n.x, by: n.y, w: r, h: f };
|
|
82
99
|
}
|
|
83
100
|
}
|
|
84
|
-
return { placement: "manual", tx:
|
|
101
|
+
return { placement: "manual", tx: p, ty: m, bx: n.x, by: n.y, w: r, h: f };
|
|
85
102
|
}
|
|
86
|
-
const
|
|
87
|
-
let
|
|
88
|
-
if (
|
|
89
|
-
let
|
|
90
|
-
const { scaleX:
|
|
91
|
-
if (
|
|
92
|
-
const
|
|
93
|
-
|
|
103
|
+
const C = (S) => c ? S === "top" ? c.top : c.bottom : m;
|
|
104
|
+
let y = o;
|
|
105
|
+
if (o === "auto") {
|
|
106
|
+
let S = m > (i.height || 600) / 2 ? "top" : "bottom", W = et(a);
|
|
107
|
+
const { scaleX: $, scaleY: g } = i;
|
|
108
|
+
if (i.viewportHeight) {
|
|
109
|
+
const E = i.top + (C("top") - f - l) * g >= 0, A = i.top + (C("bottom") + f + l) * g <= i.viewportHeight;
|
|
110
|
+
S === "top" && !E && A ? S = "bottom" : S === "bottom" && !A && E && (S = "top");
|
|
94
111
|
}
|
|
95
|
-
if (
|
|
96
|
-
const
|
|
97
|
-
|
|
112
|
+
if (i.viewportWidth) {
|
|
113
|
+
const E = i.left + (p - r - l) * $ >= 0, A = i.left + (p + r + l) * $ <= i.viewportWidth;
|
|
114
|
+
W === "left" && !E && A ? W = "right" : W === "right" && !A && E && (W = "left");
|
|
98
115
|
}
|
|
99
|
-
|
|
116
|
+
y = `${S}-${W}`;
|
|
100
117
|
}
|
|
101
|
-
const [
|
|
118
|
+
const [d, _] = y.split("-"), w = C(d);
|
|
102
119
|
return {
|
|
103
|
-
placement:
|
|
104
|
-
tx:
|
|
105
|
-
ty:
|
|
106
|
-
bx:
|
|
107
|
-
by:
|
|
108
|
-
w:
|
|
109
|
-
h:
|
|
120
|
+
placement: y,
|
|
121
|
+
tx: p,
|
|
122
|
+
ty: w,
|
|
123
|
+
bx: _ === "left" ? p - r - l : p + l,
|
|
124
|
+
by: d === "top" ? w - f - l : w + l,
|
|
125
|
+
w: r,
|
|
126
|
+
h: f
|
|
110
127
|
};
|
|
111
128
|
}
|
|
112
|
-
const
|
|
113
|
-
function
|
|
129
|
+
const St = ["tx", "ty", "bx", "by"], kt = ["tx", "ty"];
|
|
130
|
+
function Wt() {
|
|
114
131
|
return typeof matchMedia < "u" && matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
115
132
|
}
|
|
116
|
-
function
|
|
117
|
-
let
|
|
118
|
-
const
|
|
119
|
-
typeof cancelAnimationFrame < "u" && cancelAnimationFrame(
|
|
133
|
+
function Et(e, t, n, i) {
|
|
134
|
+
let o = 0;
|
|
135
|
+
const u = () => {
|
|
136
|
+
typeof cancelAnimationFrame < "u" && cancelAnimationFrame(o);
|
|
120
137
|
};
|
|
121
|
-
if (!t || !e || n <= 0 || typeof requestAnimationFrame > "u" ||
|
|
122
|
-
return
|
|
123
|
-
const
|
|
124
|
-
const
|
|
125
|
-
for (const
|
|
126
|
-
|
|
127
|
-
|
|
138
|
+
if (!t || !e || n <= 0 || typeof requestAnimationFrame > "u" || Wt())
|
|
139
|
+
return i(t), { cancel: u };
|
|
140
|
+
const a = performance.now(), l = (r) => {
|
|
141
|
+
const f = Math.min(1, (r - a) / n), p = 1 - Math.pow(1 - f, 3), m = { ...t }, k = t.placement === "manual" ? kt : St;
|
|
142
|
+
for (const c of k)
|
|
143
|
+
m[c] = e[c] + (t[c] - e[c]) * p;
|
|
144
|
+
i(m), f < 1 && (o = requestAnimationFrame(l));
|
|
128
145
|
};
|
|
129
|
-
return
|
|
146
|
+
return o = requestAnimationFrame(l), { cancel: u };
|
|
130
147
|
}
|
|
131
|
-
function
|
|
132
|
-
const { geometry: t, strokeWidth: n, radius:
|
|
133
|
-
let
|
|
134
|
-
if (
|
|
135
|
-
const
|
|
136
|
-
if (
|
|
137
|
-
|
|
138
|
-
else if (
|
|
139
|
-
|
|
148
|
+
function Bt(e) {
|
|
149
|
+
const { geometry: t, strokeWidth: n, radius: i, tailBaseWidth: o } = e, { placement: u, tx: a, ty: l, bx: r, by: f, w: p, h: m } = t, k = parseFloat(i) * (i.endsWith("%") ? Math.min(p, m) / 100 : 1) || 0, c = o / 2, C = (x, h, O) => h > O ? (h + O) / 2 : Math.min(O, Math.max(h, x));
|
|
150
|
+
let y = null, d = 0;
|
|
151
|
+
if (u === "manual") {
|
|
152
|
+
const x = Math.max(r - a, a - (r + p), 0), h = Math.max(f - l, l - (f + m), 0);
|
|
153
|
+
if (x > 0 && x >= h)
|
|
154
|
+
y = a < r ? "left" : "right", d = l;
|
|
155
|
+
else if (h > 0)
|
|
156
|
+
y = l < f ? "top" : "bottom", d = a;
|
|
140
157
|
else
|
|
141
158
|
return null;
|
|
142
|
-
} else if (
|
|
143
|
-
const [
|
|
144
|
-
|
|
159
|
+
} else if (u !== "none") {
|
|
160
|
+
const [x, h] = u.split("-");
|
|
161
|
+
y = h === "left" ? "right" : "left", d = f + m * (x === "top" ? 0.65 : 0.35);
|
|
145
162
|
} else
|
|
146
163
|
return null;
|
|
147
|
-
const
|
|
148
|
-
left: (
|
|
149
|
-
right: (
|
|
150
|
-
top: (
|
|
151
|
-
bottom: (
|
|
152
|
-
}[
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
}[S], u = I ? W(B, f + k + o + n / 2, f + g - k - o - n / 2) : W(B, p + k + o + n / 2, p + x - k - o - n / 2), b = Math.max(0, Math.min(n, v / 2)), m = ([s, c]) => `${s} ${c}`, w = (s, c) => {
|
|
158
|
-
const h = y(s, b), M = Math.hypot(d - h[0], r - h[1]) || 1, C = [
|
|
159
|
-
h[0] + (d - h[0]) * b / M,
|
|
160
|
-
h[1] + (r - h[1]) * b / M
|
|
161
|
-
];
|
|
162
|
-
return {
|
|
163
|
-
inner: m(y(s, c)),
|
|
164
|
-
outer: m(y(s, 0)),
|
|
165
|
-
ctrl: m(h),
|
|
166
|
-
end: m(C)
|
|
167
|
-
};
|
|
168
|
-
}, E = (s) => {
|
|
169
|
-
const c = w(u - o, s), h = w(u + o, s);
|
|
170
|
-
return `M ${c.inner} L ${c.outer} Q ${c.ctrl} ${c.end} L ${d} ${r} L ${h.end} Q ${h.ctrl} ${h.outer} L ${h.inner}`;
|
|
171
|
-
};
|
|
164
|
+
const _ = y === "top" || y === "bottom", w = {
|
|
165
|
+
left: (x, h) => [r - h, x],
|
|
166
|
+
right: (x, h) => [r + p + h, x],
|
|
167
|
+
top: (x, h) => [x, f - h],
|
|
168
|
+
bottom: (x, h) => [x, f + m + h]
|
|
169
|
+
}[y], S = _ ? r : f, W = _ ? r + p : f + m, $ = C(
|
|
170
|
+
d,
|
|
171
|
+
S + c + n / 2 + k,
|
|
172
|
+
W - c - n / 2 - k
|
|
173
|
+
), g = ([x, h]) => `${x} ${h}`, E = n > 0 ? -n / 2 : 0, A = 2, P = 2, s = $ - c, b = $ + c, z = w(s - A, E), v = w(s, E), L = w(b, E), F = w(b + A, E), T = w(s, -(n + P)), M = w(b, -(n + P)), B = w(s, 1), I = w(b, 1);
|
|
172
174
|
return {
|
|
173
|
-
fill:
|
|
174
|
-
stroke: n ?
|
|
175
|
+
fill: `M ${g(T)} L ${g(B)} L ${g(v)} L ${a} ${l} L ${g(L)} L ${g(I)} L ${g(M)} Z`,
|
|
176
|
+
stroke: n ? `M ${g(z)} L ${g(v)} L ${a} ${l} L ${g(L)} L ${g(F)}` : null
|
|
175
177
|
};
|
|
176
178
|
}
|
|
177
|
-
|
|
179
|
+
const Lt = [
|
|
180
|
+
"left",
|
|
181
|
+
"top",
|
|
182
|
+
"right",
|
|
183
|
+
"bottom",
|
|
184
|
+
"width",
|
|
185
|
+
"height",
|
|
186
|
+
"transform",
|
|
187
|
+
"translate",
|
|
188
|
+
"inset",
|
|
189
|
+
"inset-inline",
|
|
190
|
+
"inset-block"
|
|
191
|
+
];
|
|
192
|
+
function Ct(e) {
|
|
178
193
|
return {
|
|
179
194
|
hasTarget: e,
|
|
180
195
|
placement: "none",
|
|
181
196
|
tip: null,
|
|
182
197
|
slotTip: null,
|
|
183
|
-
overlayStyle: {},
|
|
184
198
|
boxStyle: {},
|
|
185
|
-
|
|
199
|
+
svgStyle: {},
|
|
186
200
|
tail: null,
|
|
187
201
|
boxFill: "",
|
|
188
202
|
boxStroke: "",
|
|
@@ -190,15 +204,31 @@ function ct(e) {
|
|
|
190
204
|
boxZIndex: "auto"
|
|
191
205
|
};
|
|
192
206
|
}
|
|
193
|
-
function
|
|
207
|
+
function D(e, t) {
|
|
194
208
|
return e === t ? !0 : !e || !t ? !1 : e.x === t.x && e.y === t.y;
|
|
195
209
|
}
|
|
196
|
-
function
|
|
197
|
-
return e
|
|
210
|
+
function $t(e, t) {
|
|
211
|
+
return e === t ? !0 : !e || !t ? !1 : e.placement === t.placement && e.tx === t.tx && e.ty === t.ty && e.bx === t.bx && e.by === t.by && e.w === t.w && e.h === t.h;
|
|
212
|
+
}
|
|
213
|
+
function _t(e, t) {
|
|
214
|
+
return e.hasTarget === t.hasTarget && e.placement === t.placement && e.boxFill === t.boxFill && e.boxStroke === t.boxStroke && e.boxStrokeWidth === t.boxStrokeWidth && e.boxZIndex === t.boxZIndex && D(e.tip, t.tip) && D(e.slotTip, t.slotTip) && j(e.boxStyle, t.boxStyle) && j(e.svgStyle, t.svgStyle) && e.tail?.fill === t.tail?.fill && e.tail?.stroke === t.tail?.stroke;
|
|
215
|
+
}
|
|
216
|
+
function K(e) {
|
|
217
|
+
if (typeof e.checkVisibility == "function")
|
|
218
|
+
return e.checkVisibility({
|
|
219
|
+
checkOpacity: !0,
|
|
220
|
+
checkVisibilityCSS: !0
|
|
221
|
+
});
|
|
222
|
+
const t = getComputedStyle(e);
|
|
223
|
+
return !(t.display === "none" || t.visibility === "hidden" || parseFloat(t.opacity) === 0);
|
|
224
|
+
}
|
|
225
|
+
function J(e) {
|
|
226
|
+
const t = e.style;
|
|
227
|
+
return Lt.map((n) => t.getPropertyValue(n)).join("|");
|
|
198
228
|
}
|
|
199
|
-
function
|
|
200
|
-
|
|
201
|
-
let t = { ...
|
|
229
|
+
function At(e) {
|
|
230
|
+
gt();
|
|
231
|
+
let t = { ...pt }, n = null, i = null, o = null, u = {
|
|
202
232
|
left: 0,
|
|
203
233
|
top: 0,
|
|
204
234
|
width: 0,
|
|
@@ -207,154 +237,194 @@ function ft(e) {
|
|
|
207
237
|
scaleY: 1,
|
|
208
238
|
viewportWidth: 0,
|
|
209
239
|
viewportHeight: 0
|
|
210
|
-
},
|
|
211
|
-
const
|
|
212
|
-
const
|
|
213
|
-
|
|
240
|
+
}, a = null, l = null, r = null, f = null, p = null, m = null, k = Ct(!1), c = !1, C = "";
|
|
241
|
+
const y = () => {
|
|
242
|
+
const s = d();
|
|
243
|
+
_t(k, s) || (k = s, e.onChange?.(k));
|
|
214
244
|
};
|
|
215
|
-
function
|
|
216
|
-
const
|
|
217
|
-
position: "absolute",
|
|
218
|
-
inset: "0",
|
|
219
|
-
pointerEvents: "none",
|
|
220
|
-
filter: t.shadow ? O : void 0
|
|
221
|
-
}, E = l?.zIndex;
|
|
222
|
-
E && E !== "auto" && (w.zIndex = E);
|
|
223
|
-
const s = {
|
|
245
|
+
function d() {
|
|
246
|
+
const s = t.target != null, b = t.placement === "manual", z = s ? a?.placement ?? "none" : "none", v = {
|
|
224
247
|
"--pb-padding": typeof t.padding == "number" ? `${t.padding}px` : t.padding
|
|
225
248
|
};
|
|
226
|
-
if (t.maxWidth != null && (
|
|
227
|
-
|
|
228
|
-
else if (Object.assign(
|
|
249
|
+
if (t.maxWidth != null && (v["--pb-max-width"] = `${t.maxWidth}px`), t.shadow && (v.filter = mt), !s)
|
|
250
|
+
v["--pb-width"] = "fit-content";
|
|
251
|
+
else if (Object.assign(v, {
|
|
229
252
|
position: "absolute",
|
|
230
253
|
pointerEvents: "auto",
|
|
231
|
-
|
|
254
|
+
overflow: "visible"
|
|
232
255
|
}), b)
|
|
233
|
-
|
|
234
|
-
else if (Object.assign(
|
|
235
|
-
left: `${
|
|
236
|
-
top: `${
|
|
256
|
+
v["--pb-width"] = "fit-content";
|
|
257
|
+
else if (Object.assign(v, {
|
|
258
|
+
left: `${a?.bx ?? 0}px`,
|
|
259
|
+
top: `${a?.by ?? 0}px`,
|
|
237
260
|
margin: "0"
|
|
238
261
|
}), t.maxWidth == null && n) {
|
|
239
|
-
const
|
|
240
|
-
|
|
262
|
+
const M = G(n, u, t.tailLength), B = l?.placement ?? t.placement, I = B === "auto" ? et(M) : B.split("-")[1];
|
|
263
|
+
v["--pb-max-width"] = `${M[I]}px`;
|
|
241
264
|
}
|
|
242
|
-
const
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
265
|
+
const L = o?.zIndex;
|
|
266
|
+
L && L !== "auto" && (v.zIndex = L);
|
|
267
|
+
const F = s && a && o ? Bt({
|
|
268
|
+
geometry: a,
|
|
269
|
+
strokeWidth: o.strokeWidth,
|
|
270
|
+
radius: o.radius,
|
|
246
271
|
tailBaseWidth: t.tailBaseWidth
|
|
247
272
|
}) : null;
|
|
273
|
+
let T = {};
|
|
274
|
+
if (F && a && u.width && u.height) {
|
|
275
|
+
const M = o?.borderLeft ?? 0, B = o?.borderTop ?? 0;
|
|
276
|
+
T = {
|
|
277
|
+
position: "absolute",
|
|
278
|
+
left: `${-a.bx - M}px`,
|
|
279
|
+
top: `${-a.by - B}px`,
|
|
280
|
+
width: `${u.width}px`,
|
|
281
|
+
height: `${u.height}px`,
|
|
282
|
+
overflow: "visible",
|
|
283
|
+
pointerEvents: "none",
|
|
284
|
+
zIndex: o?.zIndex ?? "auto"
|
|
285
|
+
};
|
|
286
|
+
}
|
|
248
287
|
return {
|
|
249
|
-
hasTarget:
|
|
250
|
-
placement:
|
|
288
|
+
hasTarget: s,
|
|
289
|
+
placement: z,
|
|
251
290
|
tip: n,
|
|
252
|
-
slotTip:
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
boxZIndex: l?.zIndex ?? "auto"
|
|
291
|
+
slotTip: l ? { x: l.tx, y: l.ty } : n,
|
|
292
|
+
boxStyle: v,
|
|
293
|
+
svgStyle: T,
|
|
294
|
+
tail: F,
|
|
295
|
+
boxFill: o?.fill ?? "",
|
|
296
|
+
boxStroke: o?.stroke ?? "",
|
|
297
|
+
boxStrokeWidth: o?.strokeWidth ?? 0,
|
|
298
|
+
boxZIndex: o?.zIndex ?? "auto"
|
|
261
299
|
};
|
|
262
300
|
}
|
|
263
|
-
function
|
|
264
|
-
if (!n || !
|
|
265
|
-
|
|
301
|
+
function _() {
|
|
302
|
+
if (!n || !o) {
|
|
303
|
+
(l !== null || a !== null) && (l = null, w(null));
|
|
266
304
|
return;
|
|
267
305
|
}
|
|
268
|
-
const
|
|
269
|
-
r = lt({
|
|
306
|
+
const s = G(n, u, t.tailLength), b = vt({
|
|
270
307
|
tip: n,
|
|
271
|
-
box:
|
|
272
|
-
frame:
|
|
308
|
+
box: o,
|
|
309
|
+
frame: u,
|
|
273
310
|
placement: t.placement,
|
|
274
311
|
targetAnchor: t.targetAnchor,
|
|
275
|
-
targetRect:
|
|
276
|
-
room:
|
|
312
|
+
targetRect: i,
|
|
313
|
+
room: s,
|
|
277
314
|
tailLength: t.tailLength
|
|
278
|
-
})
|
|
315
|
+
});
|
|
316
|
+
$t(l, b) || (l = b, w(l));
|
|
279
317
|
}
|
|
280
|
-
function
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
318
|
+
function w(s) {
|
|
319
|
+
r?.cancel(), r = Et(
|
|
320
|
+
a,
|
|
321
|
+
s,
|
|
284
322
|
t.transitionDuration,
|
|
285
323
|
(b) => {
|
|
286
|
-
|
|
324
|
+
a = b, y();
|
|
287
325
|
}
|
|
288
326
|
);
|
|
289
327
|
}
|
|
290
|
-
function S() {
|
|
291
|
-
const
|
|
292
|
-
|
|
293
|
-
const m = ot(
|
|
328
|
+
function S(s) {
|
|
329
|
+
const b = wt(s, u);
|
|
330
|
+
return j(
|
|
294
331
|
b,
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
t.placement === "manual"
|
|
298
|
-
);
|
|
299
|
-
A(
|
|
300
|
-
m,
|
|
301
|
-
l
|
|
302
|
-
) || (l = m);
|
|
332
|
+
o
|
|
333
|
+
) ? !1 : (o = b, !0);
|
|
303
334
|
}
|
|
304
|
-
function
|
|
305
|
-
const
|
|
306
|
-
if (
|
|
307
|
-
n = null,
|
|
335
|
+
function W() {
|
|
336
|
+
const s = e.getBoxEl();
|
|
337
|
+
if (!s) {
|
|
338
|
+
n = null, i = null, o = null, l = null, a = null, c = !1, y();
|
|
339
|
+
return;
|
|
340
|
+
}
|
|
341
|
+
if (!K(s)) {
|
|
342
|
+
r?.cancel(), c = !0;
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
const b = c;
|
|
346
|
+
if (c = !1, t.target == null) {
|
|
347
|
+
n = null, i = null, o = null, l = null, a = null, y();
|
|
308
348
|
return;
|
|
309
349
|
}
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
350
|
+
const z = u;
|
|
351
|
+
u = yt(s);
|
|
352
|
+
const v = !j(
|
|
353
|
+
u,
|
|
354
|
+
z
|
|
355
|
+
), L = typeof t.target == "string" ? tt(s).querySelector(t.target) ?? Z(t.target) : Z(t.target);
|
|
356
|
+
let F = !1, T = !1;
|
|
357
|
+
if (L) {
|
|
358
|
+
const B = L.getBoundingClientRect(), { scaleX: I, scaleY: x, left: h, top: O } = u, R = {
|
|
359
|
+
left: (B.left - h) / I,
|
|
360
|
+
top: (B.top - O) / x,
|
|
361
|
+
right: (B.right - h) / I,
|
|
362
|
+
bottom: (B.bottom - O) / x
|
|
318
363
|
};
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
364
|
+
T = !j(
|
|
365
|
+
R,
|
|
366
|
+
i
|
|
367
|
+
), T && (i = R);
|
|
368
|
+
const N = {
|
|
369
|
+
x: (R.left + R.right) / 2,
|
|
370
|
+
y: (R.top + R.bottom) / 2
|
|
322
371
|
};
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
372
|
+
F = !D(n, N), n = N;
|
|
373
|
+
} else if (bt(t.target)) {
|
|
374
|
+
T = i != null, i = null;
|
|
375
|
+
const B = { x: t.target.x, y: t.target.y };
|
|
376
|
+
F = !D(n, B), n = B;
|
|
377
|
+
} else {
|
|
378
|
+
n = null, i = null, o = null, l = null, a = null, y();
|
|
327
379
|
return;
|
|
328
380
|
}
|
|
329
|
-
S()
|
|
381
|
+
const M = S(s);
|
|
382
|
+
C = J(s), !(!b && !v && !F && !T && !M && a) && _();
|
|
330
383
|
}
|
|
331
384
|
function $() {
|
|
332
|
-
|
|
385
|
+
W();
|
|
333
386
|
}
|
|
334
387
|
typeof window < "u" && (window.addEventListener("resize", $), window.addEventListener("scroll", $, !0));
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
388
|
+
const g = W;
|
|
389
|
+
function E(s) {
|
|
390
|
+
const b = e.getBoxEl();
|
|
391
|
+
if (!b) return;
|
|
392
|
+
if (s.some(
|
|
393
|
+
(L) => L.attributeName === "class" || L.attributeName === "hidden"
|
|
394
|
+
)) {
|
|
395
|
+
if (!K(b)) {
|
|
396
|
+
r?.cancel(), c = !0;
|
|
397
|
+
return;
|
|
398
|
+
}
|
|
399
|
+
g();
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
const v = J(b);
|
|
403
|
+
v !== C && (C = v, g());
|
|
340
404
|
}
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
405
|
+
function A() {
|
|
406
|
+
const s = e.getBoxEl();
|
|
407
|
+
s !== m && (m = s, f?.disconnect(), p?.disconnect(), f = null, p = null, s && (typeof ResizeObserver < "u" && (f = new ResizeObserver(() => g()), f.observe(s)), typeof MutationObserver < "u" && (p = new MutationObserver(E), p.observe(s, {
|
|
408
|
+
attributes: !0,
|
|
409
|
+
attributeFilter: ["style", "class", "hidden"]
|
|
410
|
+
}))));
|
|
411
|
+
}
|
|
412
|
+
function P() {
|
|
413
|
+
A(), g();
|
|
344
414
|
}
|
|
345
415
|
return {
|
|
346
|
-
update:
|
|
347
|
-
setConfig(
|
|
348
|
-
t = { ...t, ...
|
|
416
|
+
update: P,
|
|
417
|
+
setConfig(s) {
|
|
418
|
+
t = { ...t, ...s }, P();
|
|
349
419
|
},
|
|
350
420
|
getConfig: () => t,
|
|
351
|
-
getState: () =>
|
|
421
|
+
getState: () => k,
|
|
352
422
|
destroy() {
|
|
353
|
-
|
|
423
|
+
r?.cancel(), f?.disconnect(), p?.disconnect(), m = null, typeof window < "u" && (window.removeEventListener("resize", $), window.removeEventListener("scroll", $, !0));
|
|
354
424
|
}
|
|
355
425
|
};
|
|
356
426
|
}
|
|
357
|
-
const
|
|
427
|
+
const Tt = ["data-placement"], Ft = ["d", "fill"], Mt = ["d", "stroke", "stroke-width"], Q = /* @__PURE__ */ nt({
|
|
358
428
|
name: "PointingBubble",
|
|
359
429
|
inheritAttrs: !1,
|
|
360
430
|
__name: "PointingBubble",
|
|
@@ -370,33 +440,34 @@ const pt = ["data-placement"], ht = ["d", "fill"], mt = ["d", "stroke", "stroke-
|
|
|
370
440
|
transitionDuration: { default: 200 }
|
|
371
441
|
},
|
|
372
442
|
setup(e, { expose: t }) {
|
|
373
|
-
const n = e,
|
|
443
|
+
const n = e, i = ot(), o = Y(() => i.class), u = Y(() => i.style), a = Y(() => {
|
|
444
|
+
const { class: d, style: _, ...w } = i;
|
|
445
|
+
return w;
|
|
446
|
+
}), l = it(null), r = lt({
|
|
374
447
|
hasTarget: !1,
|
|
375
448
|
placement: "none",
|
|
376
449
|
tip: null,
|
|
377
450
|
slotTip: null,
|
|
378
|
-
overlayStyle: {},
|
|
379
451
|
boxStyle: {},
|
|
380
|
-
|
|
452
|
+
svgStyle: {},
|
|
381
453
|
tail: null,
|
|
382
454
|
boxFill: "",
|
|
383
455
|
boxStroke: "",
|
|
384
456
|
boxStrokeWidth: 0,
|
|
385
457
|
boxZIndex: "auto"
|
|
386
458
|
});
|
|
387
|
-
function d
|
|
388
|
-
return
|
|
459
|
+
function f(d) {
|
|
460
|
+
return d == null ? null : typeof d == "string" || typeof Element < "u" && d instanceof Element ? d : typeof d == "object" && "$el" in d && d.$el instanceof Element ? d.$el : typeof d == "object" && typeof d.x == "number" && typeof d.y == "number" ? d : null;
|
|
389
461
|
}
|
|
390
|
-
const
|
|
391
|
-
getRootEl: () => a.value,
|
|
462
|
+
const p = rt(), m = At({
|
|
392
463
|
getBoxEl: () => l.value,
|
|
393
|
-
onChange: (
|
|
394
|
-
|
|
464
|
+
onChange: (d) => {
|
|
465
|
+
Object.assign(r, d), p?.update();
|
|
395
466
|
}
|
|
396
467
|
});
|
|
397
|
-
function
|
|
398
|
-
|
|
399
|
-
target:
|
|
468
|
+
function k() {
|
|
469
|
+
m.setConfig({
|
|
470
|
+
target: f(n.target),
|
|
400
471
|
placement: n.placement,
|
|
401
472
|
targetAnchor: n.targetAnchor,
|
|
402
473
|
maxWidth: n.maxWidth,
|
|
@@ -407,7 +478,7 @@ const pt = ["data-placement"], ht = ["d", "fill"], mt = ["d", "stroke", "stroke-
|
|
|
407
478
|
transitionDuration: n.transitionDuration
|
|
408
479
|
});
|
|
409
480
|
}
|
|
410
|
-
|
|
481
|
+
st(
|
|
411
482
|
() => [
|
|
412
483
|
n.target,
|
|
413
484
|
typeof n.target == "object" && n.target && "x" in n.target ? n.target.x : null,
|
|
@@ -421,90 +492,78 @@ const pt = ["data-placement"], ht = ["d", "fill"], mt = ["d", "stroke", "stroke-
|
|
|
421
492
|
n.shadow,
|
|
422
493
|
n.transitionDuration
|
|
423
494
|
],
|
|
424
|
-
|
|
495
|
+
k,
|
|
425
496
|
{ flush: "post" }
|
|
426
|
-
),
|
|
427
|
-
|
|
428
|
-
}),
|
|
429
|
-
|
|
497
|
+
), at(() => {
|
|
498
|
+
k();
|
|
499
|
+
}), ct(() => {
|
|
500
|
+
m.destroy();
|
|
430
501
|
});
|
|
431
|
-
function
|
|
432
|
-
|
|
502
|
+
function c() {
|
|
503
|
+
m.update();
|
|
433
504
|
}
|
|
434
|
-
t({ update:
|
|
435
|
-
const
|
|
436
|
-
() => i.value.rootIsBox ? i.value.boxStyle : i.value.overlayStyle
|
|
437
|
-
), x = R(() => i.value.rootIsBox ? { display: "contents" } : i.value.boxStyle), k = R(
|
|
505
|
+
t({ update: c });
|
|
506
|
+
const C = Y(
|
|
438
507
|
() => ({
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
width: "100%",
|
|
442
|
-
height: "100%",
|
|
443
|
-
overflow: "visible",
|
|
444
|
-
zIndex: i.value.boxZIndex
|
|
508
|
+
...u.value,
|
|
509
|
+
...r.boxStyle
|
|
445
510
|
})
|
|
446
|
-
);
|
|
447
|
-
return (
|
|
511
|
+
), y = Y(() => r.svgStyle);
|
|
512
|
+
return (d, _) => (H(), q("div", ut({
|
|
448
513
|
ref_key: "rootRef",
|
|
449
|
-
ref:
|
|
450
|
-
class: ["pointing-bubble",
|
|
451
|
-
"data-placement":
|
|
452
|
-
},
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
fontWeight: 600,
|
|
466
|
-
color: "#1e293b"
|
|
467
|
-
} }, " Callout content ", -1))
|
|
468
|
-
])
|
|
469
|
-
], 16),
|
|
470
|
-
e.target && i.value.tail ? (z(), T("svg", {
|
|
514
|
+
ref: l,
|
|
515
|
+
class: ["pointing-bubble", "pointing-bubble__inner", o.value],
|
|
516
|
+
"data-placement": r.placement
|
|
517
|
+
}, a.value, { style: C.value }), [
|
|
518
|
+
dt(d.$slots, "default", {
|
|
519
|
+
placement: r.placement,
|
|
520
|
+
tip: r.slotTip
|
|
521
|
+
}, () => [
|
|
522
|
+
_[0] || (_[0] = X("p", { style: {
|
|
523
|
+
margin: 0,
|
|
524
|
+
fontSize: "14px",
|
|
525
|
+
fontWeight: 600,
|
|
526
|
+
color: "#1e293b"
|
|
527
|
+
} }, " Callout content ", -1))
|
|
528
|
+
]),
|
|
529
|
+
e.target && r.tail ? (H(), q("svg", {
|
|
471
530
|
key: 0,
|
|
472
531
|
class: "pointing-bubble__svg",
|
|
473
|
-
style:
|
|
532
|
+
style: ft(y.value)
|
|
474
533
|
}, [
|
|
475
|
-
|
|
534
|
+
X("path", {
|
|
476
535
|
class: "pointing-bubble__path",
|
|
477
|
-
d:
|
|
478
|
-
fill:
|
|
479
|
-
}, null, 8,
|
|
480
|
-
|
|
536
|
+
d: r.tail.fill,
|
|
537
|
+
fill: r.boxFill
|
|
538
|
+
}, null, 8, Ft),
|
|
539
|
+
r.tail.stroke ? (H(), q("path", {
|
|
481
540
|
key: 0,
|
|
482
541
|
class: "pointing-bubble__path",
|
|
483
|
-
d:
|
|
542
|
+
d: r.tail.stroke,
|
|
484
543
|
fill: "none",
|
|
485
|
-
stroke:
|
|
486
|
-
"stroke-width":
|
|
544
|
+
stroke: r.boxStroke,
|
|
545
|
+
"stroke-width": r.boxStrokeWidth,
|
|
487
546
|
"stroke-linejoin": "round",
|
|
488
547
|
"stroke-linecap": "butt"
|
|
489
|
-
}, null, 8,
|
|
490
|
-
], 4)) :
|
|
491
|
-
], 16,
|
|
548
|
+
}, null, 8, Mt)) : U("", !0)
|
|
549
|
+
], 4)) : U("", !0)
|
|
550
|
+
], 16, Tt));
|
|
492
551
|
}
|
|
493
|
-
}),
|
|
552
|
+
}), It = {
|
|
494
553
|
install(e, t = {}) {
|
|
495
554
|
const n = t.name ?? "PointingBubble";
|
|
496
|
-
e.component(n,
|
|
555
|
+
e.component(n, Q), e.component("Callout", Q);
|
|
497
556
|
}
|
|
498
557
|
};
|
|
499
558
|
export {
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
559
|
+
Q as Callout,
|
|
560
|
+
pt as DEFAULT_BUBBLE_CONFIG,
|
|
561
|
+
Q as PointingBubble,
|
|
562
|
+
It as PointingBubblePlugin,
|
|
563
|
+
Bt as buildTailPaths,
|
|
564
|
+
vt as computeGeometry,
|
|
565
|
+
At as createBubbleController,
|
|
566
|
+
Q as default,
|
|
567
|
+
bt as isPoint,
|
|
568
|
+
Z as resolveElement
|
|
510
569
|
};
|