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