vue-pointing-bubble 0.2.0 → 0.5.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/README.md +4 -4
- package/dist/pointing-bubble/PointingBubble.vue.d.ts +1 -1
- package/dist/pointing-bubble/core.d.ts +1 -1
- package/dist/pointing-bubble/createBubbleController.d.ts +7 -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 +345 -345
- 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,7 +2,7 @@ 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';
|
|
@@ -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
|
}
|
|
@@ -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 f=require("vue"),N={target:null,placement:"auto",targetAnchor:"center",tailLength:45,tailBaseWidth:24,padding:8,shadow:!0,transitionDuration:200},j="pointing-bubble-styles",Q=`: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(n=document){if(n.getElementById(I))return;const e=n.createElement("style");e.id=I,e.textContent=U,n.head.prepend(e)}function P(n){return typeof n=="object"&&n!==null&&typeof n.x=="number"&&typeof n.y=="number"&&n.nodeType!==1}function D(n){return typeof Element>"u"||n==null?null:typeof n=="string"?document.querySelector(n):n instanceof Element?n:null}function z(n,e){return!n||!e?!1:Object.keys(n).every(t=>n[t]===e[t])}function X(n){const e=n.getBoundingClientRect(),t=getComputedStyle(n),a=parseFloat(t.width)||0,l=parseFloat(t.height)||0;return{left:e.left,top:e.top,width:a,height:l,scaleX:a?e.width/a:1,scaleY:l?e.height/l:1,viewportWidth:window.innerWidth,viewportHeight:window.innerHeight}}function G(n,e,t,a){const l=getComputedStyle(n),{scaleX:r,scaleY:u}=t,i=n.getBoundingClientRect(),d=e.getBoundingClientRect();return{x:a?(i.left-d.left)/r:0,y:a?(i.top-d.top)/u:0,width:i.width/r,height:i.height/u,fill:l.backgroundColor,stroke:l.borderTopColor,strokeWidth:parseFloat(l.borderTopWidth)||0,radius:l.borderTopLeftRadius,zIndex:l.zIndex}}function F(n,e,t){const a=n.x-t;let l=a,r=e.width?e.width-n.x-t:1/0;return e.viewportWidth&&(l=Math.min(l,e.left/e.scaleX+a),r=Math.min(r,(e.viewportWidth-e.left)/e.scaleX-n.x-t)),{left:Math.max(0,l),right:Math.max(0,r)}}function O(n){return n.left>n.right?"left":"right"}function j(n){const{tip:e,box:t,frame:a,placement:l,targetRect:r,room:u,tailLength:i}=n;if(!t.width||!t.height)return null;const{width:d,height:f}=t,{x,y}=e,E=l==="manual",o=n.targetAnchor==="edge"?r:null;if(E){if(o){const v=t.x+d/2,w=t.y+f/2;if(!(v>=o.left&&v<=o.right&&w>=o.top&&w<=o.bottom)){const g=Math.min(o.right,Math.max(o.left,v)),b=Math.min(o.bottom,Math.max(o.top,w));return{placement:"manual",tx:g,ty:b,bx:t.x,by:t.y,w:d,h:f}}}return{placement:"manual",tx:x,ty:y,bx:t.x,by:t.y,w:d,h:f}}const k=v=>o?v==="top"?o.top:o.bottom:y;let S=l;if(l==="auto"){let v=y>(a.height||600)/2?"top":"bottom",w=O(u);const{scaleX:p,scaleY:g}=a;if(a.viewportHeight){const b=a.top+(k("top")-f-i)*g>=0,B=a.top+(k("bottom")+f+i)*g<=a.viewportHeight;v==="top"&&!b&&B?v="bottom":v==="bottom"&&!B&&b&&(v="top")}if(a.viewportWidth){const b=a.left+(x-d-i)*p>=0,B=a.left+(x+d+i)*p<=a.viewportWidth;w==="left"&&!b&&B?w="right":w==="right"&&!B&&b&&(w="left")}S=`${v}-${w}`}const[W,C]=S.split("-"),$=k(W);return{placement:S,tx:x,ty:$,bx:C==="left"?x-d-i:x+i,by:W==="top"?$-f-i:$+i,w:d,h:f}}const q=["tx","ty","bx","by"],V=["tx","ty"];function Z(){return typeof matchMedia<"u"&&matchMedia("(prefers-reduced-motion: reduce)").matches}function K(n,e,t,a){let l=0;const r=()=>{typeof cancelAnimationFrame<"u"&&cancelAnimationFrame(l)};if(!e||!n||t<=0||typeof requestAnimationFrame>"u"||Z())return a(e),{cancel:r};const u=performance.now(),i=d=>{const f=Math.min(1,(d-u)/t),x=1-Math.pow(1-f,3),y={...e},E=e.placement==="manual"?V:q;for(const o of E)y[o]=n[o]+(e[o]-n[o])*x;a(y),f<1&&(l=requestAnimationFrame(i))};return l=requestAnimationFrame(i),{cancel:r}}function N(n){const{geometry:e,strokeWidth:t,radius:a,tailBaseWidth:l}=n,{placement:r,tx:u,ty:i,bx:d,by:f,w:x,h:y}=e,E=parseFloat(a)*(a.endsWith("%")?Math.min(x,y)/100:1)||0,o=l/2,k=(s,c,h)=>c>h?(c+h)/2:Math.min(h,Math.max(c,s));let S=null,W=0;if(r==="manual"){const s=Math.max(d-u,u-(d+x),0),c=Math.max(f-i,i-(f+y),0);if(s>0&&s>=c)S=u<d?"left":"right",W=i;else if(c>0)S=i<f?"top":"bottom",W=u;else return null}else if(r!=="none"){const[s,c]=r.split("-");S=c==="left"?"right":"left",W=f+y*(s==="top"?.65:.35)}else return null;const C=1,$=S==="top"||S==="bottom",v={left:(s,c)=>[d-c,s],right:(s,c)=>[d+x+c,s],top:(s,c)=>[s,f-c],bottom:(s,c)=>[s,f+y+c]}[S],w={left:d-u,right:u-d-x,top:f-i,bottom:i-f-y}[S],p=$?k(W,d+E+o+t/2,d+x-E-o-t/2):k(W,f+E+o+t/2,f+y-E-o-t/2),g=Math.max(0,Math.min(t,w/2)),b=([s,c])=>`${s} ${c}`,B=(s,c)=>{const h=v(s,g),L=Math.hypot(u-h[0],i-h[1])||1,R=[h[0]+(u-h[0])*g/L,h[1]+(i-h[1])*g/L];return{inner:b(v(s,c)),outer:b(v(s,0)),ctrl:b(h),end:b(R)}},M=s=>{const c=B(p-o,s),h=B(p+o,s);return`M ${c.inner} L ${c.outer} Q ${c.ctrl} ${c.end} L ${u} ${i} L ${h.end} Q ${h.ctrl} ${h.outer} L ${h.inner}`};return{fill:`${M(-t-C)} Z`,stroke:t?M(-t):null}}function Q(n){return{hasTarget:n,placement:"none",tip:null,slotTip:null,overlayStyle:{},boxStyle:{},rootIsBox:!n,tail:null,boxFill:"",boxStroke:"",boxStrokeWidth:0,boxZIndex:"auto"}}function Y(n){H();let e={...T},t=null,a=null,l=null,r={left:0,top:0,width:0,height:0,scaleX:1,scaleY:1,viewportWidth:0,viewportHeight:0},u=null,i=null,d=null,f=null,x=Q(!1);const y=()=>{x=E(),n.onChange?.(x)};function E(){const p=e.target!=null,g=e.placement==="manual",b=p?u?.placement??"none":"none",B={position:"absolute",inset:"0",pointerEvents:"none",filter:e.shadow?_:void 0},M=l?.zIndex;M&&M!=="auto"&&(B.zIndex=M);const s={"--pb-padding":typeof e.padding=="number"?`${e.padding}px`:e.padding};if(e.maxWidth!=null&&(s["--pb-max-width"]=`${e.maxWidth}px`),!p)s["--pb-width"]="fit-content",e.shadow&&(s.filter=_);else if(Object.assign(s,{position:"absolute",pointerEvents:"auto",visibility:u?"visible":"hidden"}),g)s["--pb-width"]="fit-content";else if(Object.assign(s,{left:`${u?.bx??0}px`,top:`${u?.by??0}px`,margin:"0"}),e.maxWidth==null&&t){const h=F(t,r,e.tailLength),L=i?.placement??e.placement,R=L==="auto"?O(h):L.split("-")[1];s["--pb-max-width"]=`${h[R]}px`}const c=p&&u&&l?N({geometry:u,strokeWidth:l.strokeWidth,radius:l.radius,tailBaseWidth:e.tailBaseWidth}):null;return{hasTarget:p,placement:b,tip:t,slotTip:i?{x:i.tx,y:i.ty}:t,overlayStyle:B,boxStyle:s,rootIsBox:!p,tail:c,boxFill:l?.fill??"",boxStroke:l?.stroke??"",boxStrokeWidth:l?.strokeWidth??0,boxZIndex:l?.zIndex??"auto"}}function o(){if(!t||!l){i=null,k(null);return}const p=F(t,r,e.tailLength);i=j({tip:t,box:l,frame:r,placement:e.placement,targetAnchor:e.targetAnchor,targetRect:a,room:p,tailLength:e.tailLength}),k(i)}function k(p){d?.cancel(),d=K(u,p,e.transitionDuration,g=>{u=g,y()})}function S(){const p=n.getRootEl(),g=n.getBoxEl();if(!g||e.target==null||!p)return;const b=G(g,p,r,e.placement==="manual");z(b,l)||(l=b)}function W(){const p=n.getRootEl();if(e.target==null||!p){t=null,a=null,l=null,i=null,u=null,y();return}r=X(p);const g=D(e.target);if(g){const b=g.getBoundingClientRect(),{scaleX:B,scaleY:M,left:s,top:c}=r,h={left:(b.left-s)/B,top:(b.top-c)/M,right:(b.right-s)/B,bottom:(b.bottom-c)/M};z(h,a)||(a=h),t={x:(h.left+h.right)/2,y:(h.top+h.bottom)/2}}else if(P(e.target))a=null,t={x:e.target.x,y:e.target.y};else{a=null,t=null,l=null,i=null,u=null,y();return}S(),o()}function C(){W()}typeof window<"u"&&(window.addEventListener("resize",C),window.addEventListener("scroll",C,!0));function $(){if(typeof ResizeObserver>"u")return;f?.disconnect(),f=new ResizeObserver(()=>W());const p=n.getRootEl(),g=n.getBoxEl();p&&f.observe(p),g&&f.observe(g)}const v=W;function w(){$(),v()}return{update:w,setConfig(p){e={...e,...p},w()},getConfig:()=>e,getState:()=>x,destroy(){d?.cancel(),f?.disconnect(),typeof window<"u"&&(window.removeEventListener("resize",C),window.removeEventListener("scroll",C,!0))}}}const J=["data-placement"],tt=["d","fill"],et=["d","stroke","stroke-width"],A=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(n,{expose:e}){const t=n,a=m.ref(null),l=m.ref(null),r=m.ref({hasTarget:!1,placement:"none",tip:null,slotTip:null,overlayStyle:{},boxStyle:{},rootIsBox:!0,tail:null,boxFill:"",boxStroke:"",boxStrokeWidth:0,boxZIndex:"auto"});function u(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 i=Y({getRootEl:()=>a.value,getBoxEl:()=>l.value,onChange:o=>{r.value=o}});function d(){i.setConfig({target:u(t.target),placement:t.placement,targetAnchor:t.targetAnchor,maxWidth:t.maxWidth,tailLength:t.tailLength,tailBaseWidth:t.tailBaseWidth,padding:t.padding,shadow:t.shadow,transitionDuration:t.transitionDuration})}m.watch(()=>[t.target,typeof t.target=="object"&&t.target&&"x"in t.target?t.target.x:null,typeof t.target=="object"&&t.target&&"y"in t.target?t.target.y:null,t.placement,t.targetAnchor,t.maxWidth,t.tailLength,t.tailBaseWidth,t.padding,t.shadow,t.transitionDuration],d,{flush:"post"}),m.onMounted(()=>{d()}),m.onUpdated(()=>{i.update()}),m.onBeforeUnmount(()=>{i.destroy()});function f(){i.update()}e({update:f});const x=m.computed(()=>r.value.rootIsBox?r.value.boxStyle:r.value.overlayStyle),y=m.computed(()=>r.value.rootIsBox?{display:"contents"}:r.value.boxStyle),E=m.computed(()=>({position:"absolute",inset:"0",width:"100%",height:"100%",overflow:"visible",zIndex:r.value.boxZIndex}));return(o,k)=>(m.openBlock(),m.createElementBlock("div",m.mergeProps({ref_key:"rootRef",ref:a,class:["pointing-bubble",{"pointing-bubble__inner":!n.target}],"data-placement":r.value.placement},n.target?{}:o.$attrs,{style:x.value}),[m.createElementVNode("div",m.mergeProps({ref_key:"boxRef",ref:l,class:{"pointing-bubble__inner":!!n.target}},n.target?o.$attrs:{},{style:y.value}),[m.renderSlot(o.$slots,"default",{placement:r.value.placement,tip:r.value.slotTip},()=>[k[0]||(k[0]=m.createElementVNode("p",{style:{margin:0,fontSize:"14px",fontWeight:600,color:"#1e293b"}}," Callout content ",-1))])],16),n.target&&r.value.tail?(m.openBlock(),m.createElementBlock("svg",{key:0,class:"pointing-bubble__svg",style:m.normalizeStyle(E.value)},[m.createElementVNode("path",{class:"pointing-bubble__path",d:r.value.tail.fill,fill:r.value.boxFill},null,8,tt),r.value.tail.stroke?(m.openBlock(),m.createElementBlock("path",{key:0,class:"pointing-bubble__path",d:r.value.tail.stroke,fill:"none",stroke:r.value.boxStroke,"stroke-width":r.value.boxStrokeWidth,"stroke-linejoin":"round","stroke-linecap":"butt"},null,8,et)):m.createCommentVNode("",!0)],4)):m.createCommentVNode("",!0)],16,J))}}),nt={install(n,e={}){const t=e.name??"PointingBubble";n.component(t,A),n.component("Callout",A)}};exports.Callout=A;exports.DEFAULT_BUBBLE_CONFIG=T;exports.PointingBubble=A;exports.PointingBubblePlugin=nt;exports.buildTailPaths=N;exports.computeGeometry=j;exports.createBubbleController=Y;exports.default=A;exports.isPoint=P;exports.resolveElement=D;
|
|
9
|
+
}`,tt="drop-shadow(0 6px 8px rgba(0, 0, 0, 0.25))";function et(n=document){if(n.getElementById(j))return;const t=n.createElement("style");t.id=j,t.textContent=Q,n.head.prepend(t)}function q(n){return typeof n=="object"&&n!==null&&typeof n.x=="number"&&typeof n.y=="number"&&n.nodeType!==1}function R(n){return typeof Element>"u"||n==null?null:typeof n=="string"?document.querySelector(n):n instanceof Element?n:null}function I(n,t){return!n||!t?!1:Object.keys(n).every(e=>n[e]===t[e])}function U(n){let t=n.parentElement;for(;t;){const e=getComputedStyle(t).position;if(e&&e!=="static")return t;if(t===document.documentElement)break;t=t.parentElement}return document.documentElement}function nt(n){const t=n.getBoundingClientRect(),e=getComputedStyle(n),i=parseFloat(e.width)||0,o=parseFloat(e.height)||0;return{left:t.left,top:t.top,width:i,height:o,scaleX:i?t.width/i:1,scaleY:o?t.height/o:1,viewportWidth:window.innerWidth,viewportHeight:window.innerHeight}}function ot(n){return nt(U(n))}function lt(n,t){const e=getComputedStyle(n),{scaleX:i,scaleY:o,left:u,top:d}=t,r=n.getBoundingClientRect();return{x:(r.left-u)/i,y:(r.top-d)/o,width:r.width/i,height:r.height/o,fill:e.backgroundColor,stroke:e.borderTopColor,strokeWidth:parseFloat(e.borderTopWidth)||0,borderLeft:(parseFloat(e.borderLeftWidth)||0)/i,borderTop:(parseFloat(e.borderTopWidth)||0)/o,radius:e.borderTopLeftRadius,zIndex:e.zIndex}}function D(n,t,e){const i=n.x-e;let o=i,u=t.width?t.width-n.x-e:1/0;return t.viewportWidth&&(o=Math.min(o,t.left/t.scaleX+i),u=Math.min(u,(t.viewportWidth-t.left)/t.scaleX-n.x-e)),{left:Math.max(0,o),right:Math.max(0,u)}}function X(n){return n.left>n.right?"left":"right"}function H(n){const{tip:t,box:e,frame:i,placement:o,targetRect:u,room:d,tailLength:r}=n;if(!e.width||!e.height)return null;const{width:s,height:p}=e,{x:h,y:m}=t,W=o==="manual",c=n.targetAnchor==="edge"?u:null;if(W){if(c){const b=e.x+s/2,k=e.y+p/2;if(!(b>=c.left&&b<=c.right&&k>=c.top&&k<=c.bottom)){const g=Math.min(c.right,Math.max(c.left,b)),l=Math.min(c.bottom,Math.max(c.top,k));return{placement:"manual",tx:g,ty:l,bx:e.x,by:e.y,w:s,h:p}}}return{placement:"manual",tx:h,ty:m,bx:e.x,by:e.y,w:s,h:p}}const _=b=>c?b==="top"?c.top:c.bottom:m;let B=o;if(o==="auto"){let b=m>(i.height||600)/2?"top":"bottom",k=X(d);const{scaleX:M,scaleY:g}=i;if(i.viewportHeight){const l=i.top+(_("top")-p-r)*g>=0,x=i.top+(_("bottom")+p+r)*g<=i.viewportHeight;b==="top"&&!l&&x?b="bottom":b==="bottom"&&!x&&l&&(b="top")}if(i.viewportWidth){const l=i.left+(h-s-r)*M>=0,x=i.left+(h+s+r)*M<=i.viewportWidth;k==="left"&&!l&&x?k="right":k==="right"&&!x&&l&&(k="left")}B=`${b}-${k}`}const[a,$]=B.split("-"),w=_(a);return{placement:B,tx:h,ty:w,bx:$==="left"?h-s-r:h+r,by:a==="top"?w-p-r:w+r,w:s,h:p}}const it=["tx","ty","bx","by"],rt=["tx","ty"];function st(){return typeof matchMedia<"u"&&matchMedia("(prefers-reduced-motion: reduce)").matches}function at(n,t,e,i){let o=0;const u=()=>{typeof cancelAnimationFrame<"u"&&cancelAnimationFrame(o)};if(!t||!n||e<=0||typeof requestAnimationFrame>"u"||st())return i(t),{cancel:u};const d=performance.now(),r=s=>{const p=Math.min(1,(s-d)/e),h=1-Math.pow(1-p,3),m={...t},W=t.placement==="manual"?rt:it;for(const c of W)m[c]=n[c]+(t[c]-n[c])*h;i(m),p<1&&(o=requestAnimationFrame(r))};return o=requestAnimationFrame(r),{cancel:u}}function G(n){const{geometry:t,strokeWidth:e,radius:i,tailBaseWidth:o}=n,{placement:u,tx:d,ty:r,bx:s,by:p,w:h,h:m}=t,W=parseFloat(i)*(i.endsWith("%")?Math.min(h,m)/100:1)||0,c=o/2,_=(S,y,P)=>y>P?(y+P)/2:Math.min(P,Math.max(y,S));let B=null,a=0;if(u==="manual"){const S=Math.max(s-d,d-(s+h),0),y=Math.max(p-r,r-(p+m),0);if(S>0&&S>=y)B=d<s?"left":"right",a=r;else if(y>0)B=r<p?"top":"bottom",a=d;else return null}else if(u!=="none"){const[S,y]=u.split("-");B=y==="left"?"right":"left",a=p+m*(S==="top"?.65:.35)}else return null;const $=B==="top"||B==="bottom",w={left:(S,y)=>[s-y,S],right:(S,y)=>[s+h+y,S],top:(S,y)=>[S,p-y],bottom:(S,y)=>[S,p+m+y]}[B],b=$?s:p,k=$?s+h:p+m,M=_(a,b+c+e/2+W,k-c-e/2-W),g=([S,y])=>`${S} ${y}`,l=e>0?-e/2:0,x=2,C=2,v=M-c,L=M+c,F=w(v-x,l),A=w(v,l),E=w(L,l),T=w(L+x,l),O=w(v,-(e+C)),V=w(L,-(e+C)),K=w(v,1),J=w(L,1);return{fill:`M ${g(O)} L ${g(K)} L ${g(A)} L ${d} ${r} L ${g(E)} L ${g(J)} L ${g(V)} Z`,stroke:e?`M ${g(F)} L ${g(A)} L ${d} ${r} L ${g(E)} L ${g(T)}`:null}}function ct(n){return{hasTarget:n,placement:"none",tip:null,slotTip:null,boxStyle:{},svgStyle:{},tail:null,boxFill:"",boxStroke:"",boxStrokeWidth:0,boxZIndex:"auto"}}function Y(n,t){return n===t?!0:!n||!t?!1:n.x===t.x&&n.y===t.y}function ut(n,t){return n.hasTarget===t.hasTarget&&n.placement===t.placement&&n.boxFill===t.boxFill&&n.boxStroke===t.boxStroke&&n.boxStrokeWidth===t.boxStrokeWidth&&n.boxZIndex===t.boxZIndex&&Y(n.tip,t.tip)&&Y(n.slotTip,t.slotTip)&&I(n.boxStyle,t.boxStyle)&&I(n.svgStyle,t.svgStyle)&&n.tail?.fill===t.tail?.fill&&n.tail?.stroke===t.tail?.stroke}function Z(n){et();let t={...N},e=null,i=null,o=null,u={left:0,top:0,width:0,height:0,scaleX:1,scaleY:1,viewportWidth:0,viewportHeight:0},d=null,r=null,s=null,p=null,h=null,m=null,W=ct(!1);const c=()=>{const l=_();ut(W,l)||(W=l,n.onChange?.(W))};function _(){const l=t.target!=null,x=t.placement==="manual",C=l?d?.placement??"none":"none",v={"--pb-padding":typeof t.padding=="number"?`${t.padding}px`:t.padding};if(t.maxWidth!=null&&(v["--pb-max-width"]=`${t.maxWidth}px`),t.shadow&&(v.filter=tt),!l)v["--pb-width"]="fit-content";else if(Object.assign(v,{position:"absolute",pointerEvents:"auto",overflow:"visible"}),x)v["--pb-width"]="fit-content";else if(Object.assign(v,{left:`${d?.bx??0}px`,top:`${d?.by??0}px`,margin:"0"}),t.maxWidth==null&&e){const E=D(e,u,t.tailLength),T=r?.placement??t.placement,O=T==="auto"?X(E):T.split("-")[1];v["--pb-max-width"]=`${E[O]}px`}const L=o?.zIndex;L&&L!=="auto"&&(v.zIndex=L);const F=l&&d&&o?G({geometry:d,strokeWidth:o.strokeWidth,radius:o.radius,tailBaseWidth:t.tailBaseWidth}):null;let A={};if(F&&d&&u.width&&u.height){const E=o?.borderLeft??0,T=o?.borderTop??0;A={position:"absolute",left:`${-d.bx-E}px`,top:`${-d.by-T}px`,width:`${u.width}px`,height:`${u.height}px`,overflow:"visible",pointerEvents:"none",zIndex:o?.zIndex??"auto"}}return{hasTarget:l,placement:C,tip:e,slotTip:r?{x:r.tx,y:r.ty}:e,boxStyle:v,svgStyle:A,tail:F,boxFill:o?.fill??"",boxStroke:o?.stroke??"",boxStrokeWidth:o?.strokeWidth??0,boxZIndex:o?.zIndex??"auto"}}function B(){if(!e||!o){r=null,a(null);return}const l=D(e,u,t.tailLength);r=H({tip:e,box:o,frame:u,placement:t.placement,targetAnchor:t.targetAnchor,targetRect:i,room:l,tailLength:t.tailLength}),a(r)}function a(l){s?.cancel(),s=at(d,l,t.transitionDuration,x=>{d=x,c()})}function $(l){const x=lt(l,u);I(x,o)||(o=x)}function w(){const l=n.getBoxEl();if(t.target==null||!l){e=null,i=null,o=null,r=null,d=null,c();return}u=ot(l);const x=typeof t.target=="string"?U(l).querySelector(t.target)??R(t.target):R(t.target);if(x){const C=x.getBoundingClientRect(),{scaleX:v,scaleY:L,left:F,top:A}=u,E={left:(C.left-F)/v,top:(C.top-A)/L,right:(C.right-F)/v,bottom:(C.bottom-A)/L};I(E,i)||(i=E),e={x:(E.left+E.right)/2,y:(E.top+E.bottom)/2}}else if(q(t.target))i=null,e={x:t.target.x,y:t.target.y};else{i=null,e=null,o=null,r=null,d=null,c();return}$(l),B()}function b(){w()}typeof window<"u"&&(window.addEventListener("resize",b),window.addEventListener("scroll",b,!0));const k=w;function M(){const l=n.getBoxEl();l!==m&&(m=l,p?.disconnect(),h?.disconnect(),p=null,h=null,l&&(typeof ResizeObserver<"u"&&(p=new ResizeObserver(()=>k()),p.observe(l)),typeof MutationObserver<"u"&&(h=new MutationObserver(()=>k()),h.observe(l,{attributes:!0,attributeFilter:["style"]}))))}function g(){M(),k()}return{update:g,setConfig(l){t={...t,...l},g()},getConfig:()=>t,getState:()=>W,destroy(){s?.cancel(),p?.disconnect(),h?.disconnect(),m=null,typeof window<"u"&&(window.removeEventListener("resize",b),window.removeEventListener("scroll",b,!0))}}}const dt=["data-placement"],pt=["d","fill"],ft=["d","stroke","stroke-width"],z=f.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(n,{expose:t}){const e=n,i=f.useAttrs(),o=f.computed(()=>i.class),u=f.computed(()=>i.style),d=f.computed(()=>{const{class:a,style:$,...w}=i;return w}),r=f.ref(null),s=f.reactive({hasTarget:!1,placement:"none",tip:null,slotTip:null,boxStyle:{},svgStyle:{},tail:null,boxFill:"",boxStroke:"",boxStrokeWidth:0,boxZIndex:"auto"});function p(a){return a==null?null:typeof a=="string"||typeof Element<"u"&&a instanceof Element?a:typeof a=="object"&&"$el"in a&&a.$el instanceof Element?a.$el:typeof a=="object"&&typeof a.x=="number"&&typeof a.y=="number"?a:null}const h=f.getCurrentInstance(),m=Z({getBoxEl:()=>r.value,onChange:a=>{Object.assign(s,a),h?.update()}});function W(){m.setConfig({target:p(e.target),placement:e.placement,targetAnchor:e.targetAnchor,maxWidth:e.maxWidth,tailLength:e.tailLength,tailBaseWidth:e.tailBaseWidth,padding:e.padding,shadow:e.shadow,transitionDuration:e.transitionDuration})}f.watch(()=>[e.target,typeof e.target=="object"&&e.target&&"x"in e.target?e.target.x:null,typeof e.target=="object"&&e.target&&"y"in e.target?e.target.y:null,e.placement,e.targetAnchor,e.maxWidth,e.tailLength,e.tailBaseWidth,e.padding,e.shadow,e.transitionDuration],W,{flush:"post"}),f.onMounted(()=>{W()}),f.onBeforeUnmount(()=>{m.destroy()});function c(){m.update()}t({update:c});const _=f.computed(()=>({...u.value,...s.boxStyle})),B=f.computed(()=>s.svgStyle);return(a,$)=>(f.openBlock(),f.createElementBlock("div",f.mergeProps({ref_key:"rootRef",ref:r,class:["pointing-bubble","pointing-bubble__inner",o.value],"data-placement":s.placement},d.value,{style:_.value}),[f.renderSlot(a.$slots,"default",{placement:s.placement,tip:s.slotTip},()=>[$[0]||($[0]=f.createElementVNode("p",{style:{margin:0,fontSize:"14px",fontWeight:600,color:"#1e293b"}}," Callout content ",-1))]),n.target&&s.tail?(f.openBlock(),f.createElementBlock("svg",{key:0,class:"pointing-bubble__svg",style:f.normalizeStyle(B.value)},[f.createElementVNode("path",{class:"pointing-bubble__path",d:s.tail.fill,fill:s.boxFill},null,8,pt),s.tail.stroke?(f.openBlock(),f.createElementBlock("path",{key:0,class:"pointing-bubble__path",d:s.tail.stroke,fill:"none",stroke:s.boxStroke,"stroke-width":s.boxStrokeWidth,"stroke-linejoin":"round","stroke-linecap":"butt"},null,8,ft)):f.createCommentVNode("",!0)],4)):f.createCommentVNode("",!0)],16,dt))}}),ht={install(n,t={}){const e=t.name??"PointingBubble";n.component(e,z),n.component("Callout",z)}};exports.Callout=z;exports.DEFAULT_BUBBLE_CONFIG=N;exports.PointingBubble=z;exports.PointingBubblePlugin=ht;exports.buildTailPaths=G;exports.computeGeometry=H;exports.createBubbleController=Z;exports.default=z;exports.isPoint=q;exports.resolveElement=R;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
const
|
|
1
|
+
import { defineComponent as J, useAttrs as Q, computed as T, ref as tt, reactive as et, getCurrentInstance as nt, watch as ot, onMounted as it, onBeforeUnmount as lt, openBlock as O, createElementBlock as j, mergeProps as rt, renderSlot as st, createElementVNode as D, normalizeStyle as at, createCommentVNode as Y } from "vue";
|
|
2
|
+
const ct = {
|
|
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
|
+
}, P = "pointing-bubble-styles", ut = `: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,174 @@ const Q = {
|
|
|
16
16
|
background: white;
|
|
17
17
|
border: 2px solid gray;
|
|
18
18
|
border-radius: 8px;
|
|
19
|
-
}`,
|
|
20
|
-
function
|
|
21
|
-
if (n.getElementById(
|
|
22
|
-
const
|
|
23
|
-
|
|
19
|
+
}`, dt = "drop-shadow(0 6px 8px rgba(0, 0, 0, 0.25))";
|
|
20
|
+
function pt(n = document) {
|
|
21
|
+
if (n.getElementById(P)) return;
|
|
22
|
+
const t = n.createElement("style");
|
|
23
|
+
t.id = P, t.textContent = ut, n.head.prepend(t);
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function ft(n) {
|
|
26
26
|
return typeof n == "object" && n !== null && typeof n.x == "number" && typeof n.y == "number" && n.nodeType !== 1;
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function X(n) {
|
|
29
29
|
return typeof Element > "u" || n == null ? null : typeof n == "string" ? document.querySelector(n) : n instanceof Element ? n : null;
|
|
30
30
|
}
|
|
31
|
-
function
|
|
32
|
-
return !n || !
|
|
31
|
+
function z(n, t) {
|
|
32
|
+
return !n || !t ? !1 : Object.keys(n).every((e) => n[e] === t[e]);
|
|
33
33
|
}
|
|
34
|
-
function
|
|
35
|
-
|
|
34
|
+
function U(n) {
|
|
35
|
+
let t = n.parentElement;
|
|
36
|
+
for (; t; ) {
|
|
37
|
+
const e = getComputedStyle(t).position;
|
|
38
|
+
if (e && e !== "static") return t;
|
|
39
|
+
if (t === document.documentElement) break;
|
|
40
|
+
t = t.parentElement;
|
|
41
|
+
}
|
|
42
|
+
return document.documentElement;
|
|
43
|
+
}
|
|
44
|
+
function ht(n) {
|
|
45
|
+
const t = n.getBoundingClientRect(), e = getComputedStyle(n), l = parseFloat(e.width) || 0, o = parseFloat(e.height) || 0;
|
|
36
46
|
return {
|
|
37
|
-
left:
|
|
38
|
-
top:
|
|
39
|
-
width:
|
|
40
|
-
height:
|
|
41
|
-
scaleX:
|
|
42
|
-
scaleY:
|
|
47
|
+
left: t.left,
|
|
48
|
+
top: t.top,
|
|
49
|
+
width: l,
|
|
50
|
+
height: o,
|
|
51
|
+
scaleX: l ? t.width / l : 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 mt(n) {
|
|
58
|
+
return ht(U(n));
|
|
59
|
+
}
|
|
60
|
+
function bt(n, t) {
|
|
61
|
+
const e = getComputedStyle(n), { scaleX: l, scaleY: o, left: u, top: d } = t, r = n.getBoundingClientRect();
|
|
49
62
|
return {
|
|
50
|
-
x:
|
|
51
|
-
y:
|
|
52
|
-
width:
|
|
53
|
-
height:
|
|
54
|
-
fill:
|
|
55
|
-
stroke:
|
|
56
|
-
strokeWidth: parseFloat(
|
|
57
|
-
|
|
58
|
-
|
|
63
|
+
x: (r.left - u) / l,
|
|
64
|
+
y: (r.top - d) / o,
|
|
65
|
+
width: r.width / l,
|
|
66
|
+
height: r.height / o,
|
|
67
|
+
fill: e.backgroundColor,
|
|
68
|
+
stroke: e.borderTopColor,
|
|
69
|
+
strokeWidth: parseFloat(e.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(e.borderLeftWidth) || 0) / l,
|
|
73
|
+
borderTop: (parseFloat(e.borderTopWidth) || 0) / o,
|
|
74
|
+
radius: e.borderTopLeftRadius,
|
|
75
|
+
zIndex: e.zIndex
|
|
59
76
|
};
|
|
60
77
|
}
|
|
61
|
-
function
|
|
62
|
-
const
|
|
63
|
-
let
|
|
64
|
-
return
|
|
65
|
-
|
|
66
|
-
(
|
|
67
|
-
)), { left: Math.max(0,
|
|
78
|
+
function q(n, t, e) {
|
|
79
|
+
const l = n.x - e;
|
|
80
|
+
let o = l, u = t.width ? t.width - n.x - e : 1 / 0;
|
|
81
|
+
return t.viewportWidth && (o = Math.min(o, t.left / t.scaleX + l), u = Math.min(
|
|
82
|
+
u,
|
|
83
|
+
(t.viewportWidth - t.left) / t.scaleX - n.x - e
|
|
84
|
+
)), { left: Math.max(0, o), right: Math.max(0, u) };
|
|
68
85
|
}
|
|
69
|
-
function
|
|
86
|
+
function Z(n) {
|
|
70
87
|
return n.left > n.right ? "left" : "right";
|
|
71
88
|
}
|
|
72
|
-
function
|
|
73
|
-
const { tip:
|
|
74
|
-
if (!
|
|
75
|
-
const { width:
|
|
76
|
-
if (
|
|
77
|
-
if (
|
|
78
|
-
const
|
|
79
|
-
if (!(
|
|
80
|
-
const b = Math.min(
|
|
81
|
-
return { placement: "manual", tx: b, ty:
|
|
89
|
+
function gt(n) {
|
|
90
|
+
const { tip: t, box: e, frame: l, placement: o, targetRect: u, room: d, tailLength: r } = n;
|
|
91
|
+
if (!e.width || !e.height) return null;
|
|
92
|
+
const { width: s, height: p } = e, { x: f, y: h } = t, k = o === "manual", c = n.targetAnchor === "edge" ? u : null;
|
|
93
|
+
if (k) {
|
|
94
|
+
if (c) {
|
|
95
|
+
const m = e.x + s / 2, S = e.y + p / 2;
|
|
96
|
+
if (!(m >= c.left && m <= c.right && S >= c.top && S <= c.bottom)) {
|
|
97
|
+
const b = Math.min(c.right, Math.max(c.left, m)), i = Math.min(c.bottom, Math.max(c.top, S));
|
|
98
|
+
return { placement: "manual", tx: b, ty: i, bx: e.x, by: e.y, w: s, h: p };
|
|
82
99
|
}
|
|
83
100
|
}
|
|
84
|
-
return { placement: "manual", tx:
|
|
101
|
+
return { placement: "manual", tx: f, ty: h, bx: e.x, by: e.y, w: s, h: p };
|
|
85
102
|
}
|
|
86
|
-
const
|
|
87
|
-
let
|
|
88
|
-
if (
|
|
89
|
-
let
|
|
90
|
-
const { scaleX:
|
|
91
|
-
if (
|
|
92
|
-
const
|
|
93
|
-
|
|
103
|
+
const $ = (m) => c ? m === "top" ? c.top : c.bottom : h;
|
|
104
|
+
let W = o;
|
|
105
|
+
if (o === "auto") {
|
|
106
|
+
let m = h > (l.height || 600) / 2 ? "top" : "bottom", S = Z(d);
|
|
107
|
+
const { scaleX: A, scaleY: b } = l;
|
|
108
|
+
if (l.viewportHeight) {
|
|
109
|
+
const i = l.top + ($("top") - p - r) * b >= 0, g = l.top + ($("bottom") + p + r) * b <= l.viewportHeight;
|
|
110
|
+
m === "top" && !i && g ? m = "bottom" : m === "bottom" && !g && i && (m = "top");
|
|
94
111
|
}
|
|
95
|
-
if (
|
|
96
|
-
const
|
|
97
|
-
|
|
112
|
+
if (l.viewportWidth) {
|
|
113
|
+
const i = l.left + (f - s - r) * A >= 0, g = l.left + (f + s + r) * A <= l.viewportWidth;
|
|
114
|
+
S === "left" && !i && g ? S = "right" : S === "right" && !g && i && (S = "left");
|
|
98
115
|
}
|
|
99
|
-
|
|
116
|
+
W = `${m}-${S}`;
|
|
100
117
|
}
|
|
101
|
-
const [
|
|
118
|
+
const [a, L] = W.split("-"), y = $(a);
|
|
102
119
|
return {
|
|
103
|
-
placement:
|
|
104
|
-
tx:
|
|
105
|
-
ty:
|
|
106
|
-
bx:
|
|
107
|
-
by:
|
|
108
|
-
w:
|
|
109
|
-
h:
|
|
120
|
+
placement: W,
|
|
121
|
+
tx: f,
|
|
122
|
+
ty: y,
|
|
123
|
+
bx: L === "left" ? f - s - r : f + r,
|
|
124
|
+
by: a === "top" ? y - p - r : y + r,
|
|
125
|
+
w: s,
|
|
126
|
+
h: p
|
|
110
127
|
};
|
|
111
128
|
}
|
|
112
|
-
const
|
|
113
|
-
function
|
|
129
|
+
const xt = ["tx", "ty", "bx", "by"], yt = ["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 vt(n, t, e, l) {
|
|
134
|
+
let o = 0;
|
|
135
|
+
const u = () => {
|
|
136
|
+
typeof cancelAnimationFrame < "u" && cancelAnimationFrame(o);
|
|
120
137
|
};
|
|
121
|
-
if (!
|
|
122
|
-
return
|
|
123
|
-
const
|
|
124
|
-
const
|
|
125
|
-
for (const
|
|
126
|
-
|
|
127
|
-
|
|
138
|
+
if (!t || !n || e <= 0 || typeof requestAnimationFrame > "u" || wt())
|
|
139
|
+
return l(t), { cancel: u };
|
|
140
|
+
const d = performance.now(), r = (s) => {
|
|
141
|
+
const p = Math.min(1, (s - d) / e), f = 1 - Math.pow(1 - p, 3), h = { ...t }, k = t.placement === "manual" ? yt : xt;
|
|
142
|
+
for (const c of k)
|
|
143
|
+
h[c] = n[c] + (t[c] - n[c]) * f;
|
|
144
|
+
l(h), p < 1 && (o = requestAnimationFrame(r));
|
|
128
145
|
};
|
|
129
|
-
return
|
|
146
|
+
return o = requestAnimationFrame(r), { cancel: u };
|
|
130
147
|
}
|
|
131
|
-
function
|
|
132
|
-
const { geometry:
|
|
133
|
-
let
|
|
134
|
-
if (
|
|
135
|
-
const
|
|
136
|
-
if (
|
|
137
|
-
|
|
138
|
-
else if (
|
|
139
|
-
|
|
148
|
+
function St(n) {
|
|
149
|
+
const { geometry: t, strokeWidth: e, radius: l, tailBaseWidth: o } = n, { placement: u, tx: d, ty: r, bx: s, by: p, w: f, h } = t, k = parseFloat(l) * (l.endsWith("%") ? Math.min(f, h) / 100 : 1) || 0, c = o / 2, $ = (v, x, R) => x > R ? (x + R) / 2 : Math.min(R, Math.max(x, v));
|
|
150
|
+
let W = null, a = 0;
|
|
151
|
+
if (u === "manual") {
|
|
152
|
+
const v = Math.max(s - d, d - (s + f), 0), x = Math.max(p - r, r - (p + h), 0);
|
|
153
|
+
if (v > 0 && v >= x)
|
|
154
|
+
W = d < s ? "left" : "right", a = r;
|
|
155
|
+
else if (x > 0)
|
|
156
|
+
W = r < p ? "top" : "bottom", a = d;
|
|
140
157
|
else
|
|
141
158
|
return null;
|
|
142
|
-
} else if (
|
|
143
|
-
const [
|
|
144
|
-
|
|
159
|
+
} else if (u !== "none") {
|
|
160
|
+
const [v, x] = u.split("-");
|
|
161
|
+
W = x === "left" ? "right" : "left", a = p + h * (v === "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], p = M ? B(k, d + W + o + t / 2, d + g - W - o - t / 2) : B(k, f + W + o + t / 2, f + x - W - o - t / 2), b = Math.max(0, Math.min(t, v / 2)), m = ([s, c]) => `${s} ${c}`, w = (s, c) => {
|
|
158
|
-
const h = y(s, b), A = Math.hypot(u - h[0], i - h[1]) || 1, C = [
|
|
159
|
-
h[0] + (u - h[0]) * b / A,
|
|
160
|
-
h[1] + (i - h[1]) * b / A
|
|
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(p - o, s), h = w(p + o, s);
|
|
170
|
-
return `M ${c.inner} L ${c.outer} Q ${c.ctrl} ${c.end} L ${u} ${i} L ${h.end} Q ${h.ctrl} ${h.outer} L ${h.inner}`;
|
|
171
|
-
};
|
|
164
|
+
const L = W === "top" || W === "bottom", y = {
|
|
165
|
+
left: (v, x) => [s - x, v],
|
|
166
|
+
right: (v, x) => [s + f + x, v],
|
|
167
|
+
top: (v, x) => [v, p - x],
|
|
168
|
+
bottom: (v, x) => [v, p + h + x]
|
|
169
|
+
}[W], m = L ? s : p, S = L ? s + f : p + h, A = $(
|
|
170
|
+
a,
|
|
171
|
+
m + c + e / 2 + k,
|
|
172
|
+
S - c - e / 2 - k
|
|
173
|
+
), b = ([v, x]) => `${v} ${x}`, i = e > 0 ? -e / 2 : 0, g = 2, _ = 2, w = A - c, B = A + c, M = y(w - g, i), C = y(w, i), E = y(B, i), F = y(B + g, i), I = y(w, -(e + _)), G = y(B, -(e + _)), K = y(w, 1), V = y(B, 1);
|
|
172
174
|
return {
|
|
173
|
-
fill:
|
|
174
|
-
stroke:
|
|
175
|
+
fill: `M ${b(I)} L ${b(K)} L ${b(C)} L ${d} ${r} L ${b(E)} L ${b(V)} L ${b(G)} Z`,
|
|
176
|
+
stroke: e ? `M ${b(M)} L ${b(C)} L ${d} ${r} L ${b(E)} L ${b(F)}` : null
|
|
175
177
|
};
|
|
176
178
|
}
|
|
177
|
-
function
|
|
179
|
+
function kt(n) {
|
|
178
180
|
return {
|
|
179
181
|
hasTarget: n,
|
|
180
182
|
placement: "none",
|
|
181
183
|
tip: null,
|
|
182
184
|
slotTip: null,
|
|
183
|
-
overlayStyle: {},
|
|
184
185
|
boxStyle: {},
|
|
185
|
-
|
|
186
|
+
svgStyle: {},
|
|
186
187
|
tail: null,
|
|
187
188
|
boxFill: "",
|
|
188
189
|
boxStroke: "",
|
|
@@ -190,9 +191,15 @@ function ut(n) {
|
|
|
190
191
|
boxZIndex: "auto"
|
|
191
192
|
};
|
|
192
193
|
}
|
|
193
|
-
function
|
|
194
|
-
|
|
195
|
-
|
|
194
|
+
function H(n, t) {
|
|
195
|
+
return n === t ? !0 : !n || !t ? !1 : n.x === t.x && n.y === t.y;
|
|
196
|
+
}
|
|
197
|
+
function Wt(n, t) {
|
|
198
|
+
return n.hasTarget === t.hasTarget && n.placement === t.placement && n.boxFill === t.boxFill && n.boxStroke === t.boxStroke && n.boxStrokeWidth === t.boxStrokeWidth && n.boxZIndex === t.boxZIndex && H(n.tip, t.tip) && H(n.slotTip, t.slotTip) && z(n.boxStyle, t.boxStyle) && z(n.svgStyle, t.svgStyle) && n.tail?.fill === t.tail?.fill && n.tail?.stroke === t.tail?.stroke;
|
|
199
|
+
}
|
|
200
|
+
function Et(n) {
|
|
201
|
+
pt();
|
|
202
|
+
let t = { ...ct }, e = null, l = null, o = null, u = {
|
|
196
203
|
left: 0,
|
|
197
204
|
top: 0,
|
|
198
205
|
width: 0,
|
|
@@ -201,153 +208,159 @@ function dt(n) {
|
|
|
201
208
|
scaleY: 1,
|
|
202
209
|
viewportWidth: 0,
|
|
203
210
|
viewportHeight: 0
|
|
204
|
-
},
|
|
205
|
-
const
|
|
206
|
-
|
|
211
|
+
}, d = null, r = null, s = null, p = null, f = null, h = null, k = kt(!1);
|
|
212
|
+
const c = () => {
|
|
213
|
+
const i = $();
|
|
214
|
+
Wt(k, i) || (k = i, n.onChange?.(k));
|
|
207
215
|
};
|
|
208
|
-
function
|
|
209
|
-
const
|
|
210
|
-
|
|
211
|
-
inset: "0",
|
|
212
|
-
pointerEvents: "none",
|
|
213
|
-
filter: e.shadow ? j : void 0
|
|
214
|
-
}, E = l?.zIndex;
|
|
215
|
-
E && E !== "auto" && (w.zIndex = E);
|
|
216
|
-
const s = {
|
|
217
|
-
"--pb-padding": typeof e.padding == "number" ? `${e.padding}px` : e.padding
|
|
216
|
+
function $() {
|
|
217
|
+
const i = t.target != null, g = t.placement === "manual", _ = i ? d?.placement ?? "none" : "none", w = {
|
|
218
|
+
"--pb-padding": typeof t.padding == "number" ? `${t.padding}px` : t.padding
|
|
218
219
|
};
|
|
219
|
-
if (
|
|
220
|
-
|
|
221
|
-
else if (Object.assign(
|
|
220
|
+
if (t.maxWidth != null && (w["--pb-max-width"] = `${t.maxWidth}px`), t.shadow && (w.filter = dt), !i)
|
|
221
|
+
w["--pb-width"] = "fit-content";
|
|
222
|
+
else if (Object.assign(w, {
|
|
222
223
|
position: "absolute",
|
|
223
224
|
pointerEvents: "auto",
|
|
224
|
-
|
|
225
|
-
}),
|
|
226
|
-
|
|
227
|
-
else if (Object.assign(
|
|
228
|
-
left: `${
|
|
229
|
-
top: `${
|
|
225
|
+
overflow: "visible"
|
|
226
|
+
}), g)
|
|
227
|
+
w["--pb-width"] = "fit-content";
|
|
228
|
+
else if (Object.assign(w, {
|
|
229
|
+
left: `${d?.bx ?? 0}px`,
|
|
230
|
+
top: `${d?.by ?? 0}px`,
|
|
230
231
|
margin: "0"
|
|
231
|
-
}),
|
|
232
|
-
const
|
|
233
|
-
|
|
232
|
+
}), t.maxWidth == null && e) {
|
|
233
|
+
const E = q(e, u, t.tailLength), F = r?.placement ?? t.placement, I = F === "auto" ? Z(E) : F.split("-")[1];
|
|
234
|
+
w["--pb-max-width"] = `${E[I]}px`;
|
|
234
235
|
}
|
|
235
|
-
const
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
236
|
+
const B = o?.zIndex;
|
|
237
|
+
B && B !== "auto" && (w.zIndex = B);
|
|
238
|
+
const M = i && d && o ? St({
|
|
239
|
+
geometry: d,
|
|
240
|
+
strokeWidth: o.strokeWidth,
|
|
241
|
+
radius: o.radius,
|
|
242
|
+
tailBaseWidth: t.tailBaseWidth
|
|
240
243
|
}) : null;
|
|
244
|
+
let C = {};
|
|
245
|
+
if (M && d && u.width && u.height) {
|
|
246
|
+
const E = o?.borderLeft ?? 0, F = o?.borderTop ?? 0;
|
|
247
|
+
C = {
|
|
248
|
+
position: "absolute",
|
|
249
|
+
left: `${-d.bx - E}px`,
|
|
250
|
+
top: `${-d.by - F}px`,
|
|
251
|
+
width: `${u.width}px`,
|
|
252
|
+
height: `${u.height}px`,
|
|
253
|
+
overflow: "visible",
|
|
254
|
+
pointerEvents: "none",
|
|
255
|
+
zIndex: o?.zIndex ?? "auto"
|
|
256
|
+
};
|
|
257
|
+
}
|
|
241
258
|
return {
|
|
242
|
-
hasTarget:
|
|
243
|
-
placement:
|
|
244
|
-
tip:
|
|
245
|
-
slotTip:
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
boxZIndex: l?.zIndex ?? "auto"
|
|
259
|
+
hasTarget: i,
|
|
260
|
+
placement: _,
|
|
261
|
+
tip: e,
|
|
262
|
+
slotTip: r ? { x: r.tx, y: r.ty } : e,
|
|
263
|
+
boxStyle: w,
|
|
264
|
+
svgStyle: C,
|
|
265
|
+
tail: M,
|
|
266
|
+
boxFill: o?.fill ?? "",
|
|
267
|
+
boxStroke: o?.stroke ?? "",
|
|
268
|
+
boxStrokeWidth: o?.strokeWidth ?? 0,
|
|
269
|
+
boxZIndex: o?.zIndex ?? "auto"
|
|
254
270
|
};
|
|
255
271
|
}
|
|
256
|
-
function
|
|
257
|
-
if (!
|
|
258
|
-
|
|
272
|
+
function W() {
|
|
273
|
+
if (!e || !o) {
|
|
274
|
+
r = null, a(null);
|
|
259
275
|
return;
|
|
260
276
|
}
|
|
261
|
-
const
|
|
262
|
-
|
|
263
|
-
tip:
|
|
264
|
-
box:
|
|
265
|
-
frame:
|
|
266
|
-
placement:
|
|
267
|
-
targetAnchor:
|
|
268
|
-
targetRect:
|
|
269
|
-
room:
|
|
270
|
-
tailLength:
|
|
271
|
-
}),
|
|
277
|
+
const i = q(e, u, t.tailLength);
|
|
278
|
+
r = gt({
|
|
279
|
+
tip: e,
|
|
280
|
+
box: o,
|
|
281
|
+
frame: u,
|
|
282
|
+
placement: t.placement,
|
|
283
|
+
targetAnchor: t.targetAnchor,
|
|
284
|
+
targetRect: l,
|
|
285
|
+
room: i,
|
|
286
|
+
tailLength: t.tailLength
|
|
287
|
+
}), a(r);
|
|
272
288
|
}
|
|
273
|
-
function
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
(
|
|
279
|
-
|
|
289
|
+
function a(i) {
|
|
290
|
+
s?.cancel(), s = vt(
|
|
291
|
+
d,
|
|
292
|
+
i,
|
|
293
|
+
t.transitionDuration,
|
|
294
|
+
(g) => {
|
|
295
|
+
d = g, c();
|
|
280
296
|
}
|
|
281
297
|
);
|
|
282
298
|
}
|
|
283
|
-
function
|
|
284
|
-
const
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
r,
|
|
290
|
-
e.placement === "manual"
|
|
291
|
-
);
|
|
292
|
-
O(
|
|
293
|
-
m,
|
|
294
|
-
l
|
|
295
|
-
) || (l = m);
|
|
299
|
+
function L(i) {
|
|
300
|
+
const g = bt(i, u);
|
|
301
|
+
z(
|
|
302
|
+
g,
|
|
303
|
+
o
|
|
304
|
+
) || (o = g);
|
|
296
305
|
}
|
|
297
|
-
function
|
|
298
|
-
const
|
|
299
|
-
if (
|
|
300
|
-
|
|
306
|
+
function y() {
|
|
307
|
+
const i = n.getBoxEl();
|
|
308
|
+
if (t.target == null || !i) {
|
|
309
|
+
e = null, l = null, o = null, r = null, d = null, c();
|
|
301
310
|
return;
|
|
302
311
|
}
|
|
303
|
-
|
|
304
|
-
const
|
|
305
|
-
if (
|
|
306
|
-
const
|
|
307
|
-
left: (
|
|
308
|
-
top: (
|
|
309
|
-
right: (
|
|
310
|
-
bottom: (
|
|
312
|
+
u = mt(i);
|
|
313
|
+
const g = typeof t.target == "string" ? U(i).querySelector(t.target) ?? X(t.target) : X(t.target);
|
|
314
|
+
if (g) {
|
|
315
|
+
const _ = g.getBoundingClientRect(), { scaleX: w, scaleY: B, left: M, top: C } = u, E = {
|
|
316
|
+
left: (_.left - M) / w,
|
|
317
|
+
top: (_.top - C) / B,
|
|
318
|
+
right: (_.right - M) / w,
|
|
319
|
+
bottom: (_.bottom - C) / B
|
|
311
320
|
};
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
321
|
+
z(
|
|
322
|
+
E,
|
|
323
|
+
l
|
|
324
|
+
) || (l = E), e = {
|
|
325
|
+
x: (E.left + E.right) / 2,
|
|
326
|
+
y: (E.top + E.bottom) / 2
|
|
315
327
|
};
|
|
316
|
-
} else if (
|
|
317
|
-
|
|
328
|
+
} else if (ft(t.target))
|
|
329
|
+
l = null, e = { x: t.target.x, y: t.target.y };
|
|
318
330
|
else {
|
|
319
|
-
|
|
331
|
+
l = null, e = null, o = null, r = null, d = null, c();
|
|
320
332
|
return;
|
|
321
333
|
}
|
|
322
|
-
|
|
334
|
+
L(i), W();
|
|
323
335
|
}
|
|
324
|
-
function
|
|
325
|
-
|
|
336
|
+
function m() {
|
|
337
|
+
y();
|
|
326
338
|
}
|
|
327
|
-
typeof window < "u" && (window.addEventListener("resize",
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
339
|
+
typeof window < "u" && (window.addEventListener("resize", m), window.addEventListener("scroll", m, !0));
|
|
340
|
+
const S = y;
|
|
341
|
+
function A() {
|
|
342
|
+
const i = n.getBoxEl();
|
|
343
|
+
i !== h && (h = i, p?.disconnect(), f?.disconnect(), p = null, f = null, i && (typeof ResizeObserver < "u" && (p = new ResizeObserver(() => S()), p.observe(i)), typeof MutationObserver < "u" && (f = new MutationObserver(() => S()), f.observe(i, {
|
|
344
|
+
attributes: !0,
|
|
345
|
+
attributeFilter: ["style"]
|
|
346
|
+
}))));
|
|
333
347
|
}
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
M(), y();
|
|
348
|
+
function b() {
|
|
349
|
+
A(), S();
|
|
337
350
|
}
|
|
338
351
|
return {
|
|
339
|
-
update:
|
|
340
|
-
setConfig(
|
|
341
|
-
|
|
352
|
+
update: b,
|
|
353
|
+
setConfig(i) {
|
|
354
|
+
t = { ...t, ...i }, b();
|
|
342
355
|
},
|
|
343
|
-
getConfig: () =>
|
|
344
|
-
getState: () =>
|
|
356
|
+
getConfig: () => t,
|
|
357
|
+
getState: () => k,
|
|
345
358
|
destroy() {
|
|
346
|
-
|
|
359
|
+
s?.cancel(), p?.disconnect(), f?.disconnect(), h = null, typeof window < "u" && (window.removeEventListener("resize", m), window.removeEventListener("scroll", m, !0));
|
|
347
360
|
}
|
|
348
361
|
};
|
|
349
362
|
}
|
|
350
|
-
const
|
|
363
|
+
const Bt = ["data-placement"], Lt = ["d", "fill"], $t = ["d", "stroke", "stroke-width"], N = /* @__PURE__ */ J({
|
|
351
364
|
name: "PointingBubble",
|
|
352
365
|
inheritAttrs: !1,
|
|
353
366
|
__name: "PointingBubble",
|
|
@@ -362,144 +375,131 @@ const ft = ["data-placement"], pt = ["d", "fill"], ht = ["d", "stroke", "stroke-
|
|
|
362
375
|
shadow: { type: Boolean, default: !0 },
|
|
363
376
|
transitionDuration: { default: 200 }
|
|
364
377
|
},
|
|
365
|
-
setup(n, { expose:
|
|
366
|
-
const
|
|
378
|
+
setup(n, { expose: t }) {
|
|
379
|
+
const e = n, l = Q(), o = T(() => l.class), u = T(() => l.style), d = T(() => {
|
|
380
|
+
const { class: a, style: L, ...y } = l;
|
|
381
|
+
return y;
|
|
382
|
+
}), r = tt(null), s = et({
|
|
367
383
|
hasTarget: !1,
|
|
368
384
|
placement: "none",
|
|
369
385
|
tip: null,
|
|
370
386
|
slotTip: null,
|
|
371
|
-
overlayStyle: {},
|
|
372
387
|
boxStyle: {},
|
|
373
|
-
|
|
388
|
+
svgStyle: {},
|
|
374
389
|
tail: null,
|
|
375
390
|
boxFill: "",
|
|
376
391
|
boxStroke: "",
|
|
377
392
|
boxStrokeWidth: 0,
|
|
378
393
|
boxZIndex: "auto"
|
|
379
394
|
});
|
|
380
|
-
function
|
|
381
|
-
return
|
|
395
|
+
function p(a) {
|
|
396
|
+
return a == null ? null : typeof a == "string" || typeof Element < "u" && a instanceof Element ? a : typeof a == "object" && "$el" in a && a.$el instanceof Element ? a.$el : typeof a == "object" && typeof a.x == "number" && typeof a.y == "number" ? a : null;
|
|
382
397
|
}
|
|
383
|
-
const
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
r.value = o;
|
|
398
|
+
const f = nt(), h = Et({
|
|
399
|
+
getBoxEl: () => r.value,
|
|
400
|
+
onChange: (a) => {
|
|
401
|
+
Object.assign(s, a), f?.update();
|
|
388
402
|
}
|
|
389
403
|
});
|
|
390
|
-
function
|
|
391
|
-
|
|
392
|
-
target:
|
|
393
|
-
placement:
|
|
394
|
-
targetAnchor:
|
|
395
|
-
maxWidth:
|
|
396
|
-
tailLength:
|
|
397
|
-
tailBaseWidth:
|
|
398
|
-
padding:
|
|
399
|
-
shadow:
|
|
400
|
-
transitionDuration:
|
|
404
|
+
function k() {
|
|
405
|
+
h.setConfig({
|
|
406
|
+
target: p(e.target),
|
|
407
|
+
placement: e.placement,
|
|
408
|
+
targetAnchor: e.targetAnchor,
|
|
409
|
+
maxWidth: e.maxWidth,
|
|
410
|
+
tailLength: e.tailLength,
|
|
411
|
+
tailBaseWidth: e.tailBaseWidth,
|
|
412
|
+
padding: e.padding,
|
|
413
|
+
shadow: e.shadow,
|
|
414
|
+
transitionDuration: e.transitionDuration
|
|
401
415
|
});
|
|
402
416
|
}
|
|
403
|
-
|
|
417
|
+
ot(
|
|
404
418
|
() => [
|
|
405
|
-
|
|
406
|
-
typeof
|
|
407
|
-
typeof
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
419
|
+
e.target,
|
|
420
|
+
typeof e.target == "object" && e.target && "x" in e.target ? e.target.x : null,
|
|
421
|
+
typeof e.target == "object" && e.target && "y" in e.target ? e.target.y : null,
|
|
422
|
+
e.placement,
|
|
423
|
+
e.targetAnchor,
|
|
424
|
+
e.maxWidth,
|
|
425
|
+
e.tailLength,
|
|
426
|
+
e.tailBaseWidth,
|
|
427
|
+
e.padding,
|
|
428
|
+
e.shadow,
|
|
429
|
+
e.transitionDuration
|
|
416
430
|
],
|
|
417
|
-
|
|
431
|
+
k,
|
|
418
432
|
{ flush: "post" }
|
|
419
|
-
),
|
|
420
|
-
|
|
421
|
-
}),
|
|
422
|
-
|
|
423
|
-
}), q(() => {
|
|
424
|
-
i.destroy();
|
|
433
|
+
), it(() => {
|
|
434
|
+
k();
|
|
435
|
+
}), lt(() => {
|
|
436
|
+
h.destroy();
|
|
425
437
|
});
|
|
426
|
-
function
|
|
427
|
-
|
|
438
|
+
function c() {
|
|
439
|
+
h.update();
|
|
428
440
|
}
|
|
429
|
-
|
|
430
|
-
const
|
|
431
|
-
() => r.value.rootIsBox ? r.value.boxStyle : r.value.overlayStyle
|
|
432
|
-
), x = R(() => r.value.rootIsBox ? { display: "contents" } : r.value.boxStyle), W = R(
|
|
441
|
+
t({ update: c });
|
|
442
|
+
const $ = T(
|
|
433
443
|
() => ({
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
width: "100%",
|
|
437
|
-
height: "100%",
|
|
438
|
-
overflow: "visible",
|
|
439
|
-
zIndex: r.value.boxZIndex
|
|
444
|
+
...u.value,
|
|
445
|
+
...s.boxStyle
|
|
440
446
|
})
|
|
441
|
-
);
|
|
442
|
-
return (
|
|
447
|
+
), W = T(() => s.svgStyle);
|
|
448
|
+
return (a, L) => (O(), j("div", rt({
|
|
443
449
|
ref_key: "rootRef",
|
|
444
|
-
ref:
|
|
445
|
-
class: ["pointing-bubble",
|
|
446
|
-
"data-placement":
|
|
447
|
-
},
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
fontWeight: 600,
|
|
461
|
-
color: "#1e293b"
|
|
462
|
-
} }, " Callout content ", -1))
|
|
463
|
-
])
|
|
464
|
-
], 16),
|
|
465
|
-
n.target && r.value.tail ? (I(), z("svg", {
|
|
450
|
+
ref: r,
|
|
451
|
+
class: ["pointing-bubble", "pointing-bubble__inner", o.value],
|
|
452
|
+
"data-placement": s.placement
|
|
453
|
+
}, d.value, { style: $.value }), [
|
|
454
|
+
st(a.$slots, "default", {
|
|
455
|
+
placement: s.placement,
|
|
456
|
+
tip: s.slotTip
|
|
457
|
+
}, () => [
|
|
458
|
+
L[0] || (L[0] = D("p", { style: {
|
|
459
|
+
margin: 0,
|
|
460
|
+
fontSize: "14px",
|
|
461
|
+
fontWeight: 600,
|
|
462
|
+
color: "#1e293b"
|
|
463
|
+
} }, " Callout content ", -1))
|
|
464
|
+
]),
|
|
465
|
+
n.target && s.tail ? (O(), j("svg", {
|
|
466
466
|
key: 0,
|
|
467
467
|
class: "pointing-bubble__svg",
|
|
468
|
-
style:
|
|
468
|
+
style: at(W.value)
|
|
469
469
|
}, [
|
|
470
|
-
|
|
470
|
+
D("path", {
|
|
471
471
|
class: "pointing-bubble__path",
|
|
472
|
-
d:
|
|
473
|
-
fill:
|
|
474
|
-
}, null, 8,
|
|
475
|
-
|
|
472
|
+
d: s.tail.fill,
|
|
473
|
+
fill: s.boxFill
|
|
474
|
+
}, null, 8, Lt),
|
|
475
|
+
s.tail.stroke ? (O(), j("path", {
|
|
476
476
|
key: 0,
|
|
477
477
|
class: "pointing-bubble__path",
|
|
478
|
-
d:
|
|
478
|
+
d: s.tail.stroke,
|
|
479
479
|
fill: "none",
|
|
480
|
-
stroke:
|
|
481
|
-
"stroke-width":
|
|
480
|
+
stroke: s.boxStroke,
|
|
481
|
+
"stroke-width": s.boxStrokeWidth,
|
|
482
482
|
"stroke-linejoin": "round",
|
|
483
483
|
"stroke-linecap": "butt"
|
|
484
|
-
}, null, 8,
|
|
485
|
-
], 4)) :
|
|
486
|
-
], 16,
|
|
484
|
+
}, null, 8, $t)) : Y("", !0)
|
|
485
|
+
], 4)) : Y("", !0)
|
|
486
|
+
], 16, Bt));
|
|
487
487
|
}
|
|
488
|
-
}),
|
|
489
|
-
install(n,
|
|
490
|
-
const
|
|
491
|
-
n.component(
|
|
488
|
+
}), At = {
|
|
489
|
+
install(n, t = {}) {
|
|
490
|
+
const e = t.name ?? "PointingBubble";
|
|
491
|
+
n.component(e, N), n.component("Callout", N);
|
|
492
492
|
}
|
|
493
493
|
};
|
|
494
494
|
export {
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
495
|
+
N as Callout,
|
|
496
|
+
ct as DEFAULT_BUBBLE_CONFIG,
|
|
497
|
+
N as PointingBubble,
|
|
498
|
+
At as PointingBubblePlugin,
|
|
499
|
+
St as buildTailPaths,
|
|
500
|
+
gt as computeGeometry,
|
|
501
|
+
Et as createBubbleController,
|
|
502
|
+
N as default,
|
|
503
|
+
ft as isPoint,
|
|
504
|
+
X as resolveElement
|
|
505
505
|
};
|