@bikdotai/bik-component-library 0.0.804-beta.12 → 0.0.804-beta.13
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.
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.createSuggestionPopup=function(e,t){const o=document.createElement("div");function
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.createSuggestionPopup=function(e,t){const o=document.createElement("div");o.style.cssText="position:fixed;z-index:9999;pointer-events:auto;",o.appendChild(e),document.body.appendChild(o);let n=t;function i(){const e=null==n?void 0:n();if(!e)return;const t=o.offsetHeight,i=o.offsetWidth,s=window.innerHeight,d=window.innerWidth,p=s-e.bottom-4,r=e.top-4,l=p>=t?e.bottom+4:r>=t?e.top-4-t:4,c=Math.min(e.left,d-i-4);o.style.left=`${Math.max(4,c)}px`,o.style.top=`${l}px`}const s=new ResizeObserver(i);return s.observe(o),i(),{element:o,show(){o.style.display=""},hide(){o.style.display="none"},destroy(){s.disconnect(),o.remove()},updatePosition(e){n=e,i()}}};
|
|
2
2
|
//# sourceMappingURL=suggestionPopup.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"suggestionPopup.js","sources":["../../../../src/editor/extensions/suggestionPopup.ts"],"sourcesContent":["/**\n * Lightweight popup positioner for suggestion dropdowns (mentions, slash commands).\n * Replaces tippy.js — all we need is a positioned container near the cursor\n * that flips above when there isn't enough room below.\n */\n\nconst GAP = 4;\n\nexport interface SuggestionPopup {\n\tshow(): void;\n\thide(): void;\n\tdestroy(): void;\n\tupdatePosition(clientRect: () => DOMRect | null): void;\n\treadonly element: HTMLDivElement;\n}\n\nexport function createSuggestionPopup(\n\tcontent: HTMLElement,\n\tclientRect: (() => DOMRect | null) | null,\n): SuggestionPopup {\n\tconst wrapper = document.createElement('div');\n\twrapper.style.cssText = 'position:fixed;z-index:9999;pointer-events:auto;';\n\twrapper.appendChild(content);\n\tdocument.body.appendChild(wrapper);\n\n\
|
|
1
|
+
{"version":3,"file":"suggestionPopup.js","sources":["../../../../src/editor/extensions/suggestionPopup.ts"],"sourcesContent":["/**\n * Lightweight popup positioner for suggestion dropdowns (mentions, slash commands).\n * Replaces tippy.js — all we need is a positioned container near the cursor\n * that flips above when there isn't enough room below.\n */\n\nconst GAP = 4;\n\nexport interface SuggestionPopup {\n\tshow(): void;\n\thide(): void;\n\tdestroy(): void;\n\tupdatePosition(clientRect: () => DOMRect | null): void;\n\treadonly element: HTMLDivElement;\n}\n\nexport function createSuggestionPopup(\n\tcontent: HTMLElement,\n\tclientRect: (() => DOMRect | null) | null,\n): SuggestionPopup {\n\tconst wrapper = document.createElement('div');\n\twrapper.style.cssText = 'position:fixed;z-index:9999;pointer-events:auto;';\n\twrapper.appendChild(content);\n\tdocument.body.appendChild(wrapper);\n\n\tlet latestRectFn: (() => DOMRect | null) | null = clientRect;\n\n\tfunction reposition() {\n\t\tconst rect = latestRectFn?.();\n\t\tif (!rect) return;\n\n\t\tconst popupHeight = wrapper.offsetHeight;\n\t\tconst popupWidth = wrapper.offsetWidth;\n\t\tconst viewportH = window.innerHeight;\n\t\tconst viewportW = window.innerWidth;\n\n\t\tconst spaceBelow = viewportH - rect.bottom - GAP;\n\t\tconst spaceAbove = rect.top - GAP;\n\t\tconst fitsBelow = spaceBelow >= popupHeight;\n\n\t\tconst top = fitsBelow\n\t\t\t? rect.bottom + GAP\n\t\t\t: spaceAbove >= popupHeight\n\t\t\t? rect.top - GAP - popupHeight\n\t\t\t: GAP;\n\n\t\tconst left = Math.min(rect.left, viewportW - popupWidth - GAP);\n\n\t\twrapper.style.left = `${Math.max(GAP, left)}px`;\n\t\twrapper.style.top = `${top}px`;\n\t}\n\n\tconst observer = new ResizeObserver(reposition);\n\tobserver.observe(wrapper);\n\n\treposition();\n\n\treturn {\n\t\telement: wrapper,\n\t\tshow() {\n\t\t\twrapper.style.display = '';\n\t\t},\n\t\thide() {\n\t\t\twrapper.style.display = 'none';\n\t\t},\n\t\tdestroy() {\n\t\t\tobserver.disconnect();\n\t\t\twrapper.remove();\n\t\t},\n\t\tupdatePosition(getRectFn: () => DOMRect | null) {\n\t\t\tlatestRectFn = getRectFn;\n\t\t\treposition();\n\t\t},\n\t};\n}\n"],"names":["content","clientRect","wrapper","document","createElement","style","cssText","appendChild","body","latestRectFn","reposition","rect","popupHeight","offsetHeight","popupWidth","offsetWidth","viewportH","window","innerHeight","viewportW","innerWidth","spaceBelow","bottom","spaceAbove","top","left","Math","min","max","observer","ResizeObserver","observe","element","show","display","hide","destroy","disconnect","remove","updatePosition","getRectFn"],"mappings":"kGAgBgB,SACfA,EACAC,GAEA,MAAMC,EAAUC,SAASC,cAAc,OACvCF,EAAQG,MAAMC,QAAU,mDACxBJ,EAAQK,YAAYP,GACpBG,SAASK,KAAKD,YAAYL,GAE1B,IAAIO,EAA8CR,EAElD,SAASS,IACR,MAAMC,EAAOF,aAAA,EAAAA,IACb,IAAKE,EAAM,OAEX,MAAMC,EAAcV,EAAQW,aACtBC,EAAaZ,EAAQa,YACrBC,EAAYC,OAAOC,YACnBC,EAAYF,OAAOG,WAEnBC,EAAaL,EAAYL,EAAKW,OA9B1B,EA+BJC,EAAaZ,EAAKa,IA/Bd,EAkCJA,EAFYH,GAAcT,EAG7BD,EAAKW,OAnCE,EAoCPC,GAAcX,EACdD,EAAKa,IArCE,EAqCUZ,EArCV,EAwCJa,EAAOC,KAAKC,IAAIhB,EAAKc,KAAMN,EAAYL,EAxCnC,GA0CVZ,EAAQG,MAAMoB,KAAU,GAAAC,KAAKE,IA1CnB,EA0C4BH,OACtCvB,EAAQG,MAAMmB,IAAS,GAAAA,KACxB,CAEA,MAAMK,EAAW,IAAIC,eAAepB,GAKpC,OAJAmB,EAASE,QAAQ7B,GAEjBQ,IAEO,CACNsB,QAAS9B,EACT+B,OACC/B,EAAQG,MAAM6B,QAAU,EACxB,EACDC,OACCjC,EAAQG,MAAM6B,QAAU,MACxB,EACDE,UACCP,EAASQ,aACTnC,EAAQoC,QACR,EACDC,eAAeC,GACd/B,EAAe+B,EACf9B,GACD,EAEF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function
|
|
1
|
+
function e(e,t){const n=document.createElement("div");n.style.cssText="position:fixed;z-index:9999;pointer-events:auto;",n.appendChild(e),document.body.appendChild(n);let o=t;function i(){const e=null==o?void 0:o();if(!e)return;const t=n.offsetHeight,i=n.offsetWidth,s=window.innerHeight,d=window.innerWidth,l=s-e.bottom-4,p=e.top-4,r=l>=t?e.bottom+4:p>=t?e.top-4-t:4,c=Math.min(e.left,d-i-4);n.style.left=`${Math.max(4,c)}px`,n.style.top=`${r}px`}const s=new ResizeObserver(i);return s.observe(n),i(),{element:n,show(){n.style.display=""},hide(){n.style.display="none"},destroy(){s.disconnect(),n.remove()},updatePosition(e){o=e,i()}}}export{e as createSuggestionPopup};
|
|
2
2
|
//# sourceMappingURL=suggestionPopup.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"suggestionPopup.js","sources":["../../../../src/editor/extensions/suggestionPopup.ts"],"sourcesContent":["/**\n * Lightweight popup positioner for suggestion dropdowns (mentions, slash commands).\n * Replaces tippy.js — all we need is a positioned container near the cursor\n * that flips above when there isn't enough room below.\n */\n\nconst GAP = 4;\n\nexport interface SuggestionPopup {\n\tshow(): void;\n\thide(): void;\n\tdestroy(): void;\n\tupdatePosition(clientRect: () => DOMRect | null): void;\n\treadonly element: HTMLDivElement;\n}\n\nexport function createSuggestionPopup(\n\tcontent: HTMLElement,\n\tclientRect: (() => DOMRect | null) | null,\n): SuggestionPopup {\n\tconst wrapper = document.createElement('div');\n\twrapper.style.cssText = 'position:fixed;z-index:9999;pointer-events:auto;';\n\twrapper.appendChild(content);\n\tdocument.body.appendChild(wrapper);\n\n\
|
|
1
|
+
{"version":3,"file":"suggestionPopup.js","sources":["../../../../src/editor/extensions/suggestionPopup.ts"],"sourcesContent":["/**\n * Lightweight popup positioner for suggestion dropdowns (mentions, slash commands).\n * Replaces tippy.js — all we need is a positioned container near the cursor\n * that flips above when there isn't enough room below.\n */\n\nconst GAP = 4;\n\nexport interface SuggestionPopup {\n\tshow(): void;\n\thide(): void;\n\tdestroy(): void;\n\tupdatePosition(clientRect: () => DOMRect | null): void;\n\treadonly element: HTMLDivElement;\n}\n\nexport function createSuggestionPopup(\n\tcontent: HTMLElement,\n\tclientRect: (() => DOMRect | null) | null,\n): SuggestionPopup {\n\tconst wrapper = document.createElement('div');\n\twrapper.style.cssText = 'position:fixed;z-index:9999;pointer-events:auto;';\n\twrapper.appendChild(content);\n\tdocument.body.appendChild(wrapper);\n\n\tlet latestRectFn: (() => DOMRect | null) | null = clientRect;\n\n\tfunction reposition() {\n\t\tconst rect = latestRectFn?.();\n\t\tif (!rect) return;\n\n\t\tconst popupHeight = wrapper.offsetHeight;\n\t\tconst popupWidth = wrapper.offsetWidth;\n\t\tconst viewportH = window.innerHeight;\n\t\tconst viewportW = window.innerWidth;\n\n\t\tconst spaceBelow = viewportH - rect.bottom - GAP;\n\t\tconst spaceAbove = rect.top - GAP;\n\t\tconst fitsBelow = spaceBelow >= popupHeight;\n\n\t\tconst top = fitsBelow\n\t\t\t? rect.bottom + GAP\n\t\t\t: spaceAbove >= popupHeight\n\t\t\t? rect.top - GAP - popupHeight\n\t\t\t: GAP;\n\n\t\tconst left = Math.min(rect.left, viewportW - popupWidth - GAP);\n\n\t\twrapper.style.left = `${Math.max(GAP, left)}px`;\n\t\twrapper.style.top = `${top}px`;\n\t}\n\n\tconst observer = new ResizeObserver(reposition);\n\tobserver.observe(wrapper);\n\n\treposition();\n\n\treturn {\n\t\telement: wrapper,\n\t\tshow() {\n\t\t\twrapper.style.display = '';\n\t\t},\n\t\thide() {\n\t\t\twrapper.style.display = 'none';\n\t\t},\n\t\tdestroy() {\n\t\t\tobserver.disconnect();\n\t\t\twrapper.remove();\n\t\t},\n\t\tupdatePosition(getRectFn: () => DOMRect | null) {\n\t\t\tlatestRectFn = getRectFn;\n\t\t\treposition();\n\t\t},\n\t};\n}\n"],"names":["createSuggestionPopup","content","clientRect","wrapper","document","createElement","style","cssText","appendChild","body","latestRectFn","reposition","rect","popupHeight","offsetHeight","popupWidth","offsetWidth","viewportH","window","innerHeight","viewportW","innerWidth","spaceBelow","bottom","spaceAbove","top","left","Math","min","max","observer","ResizeObserver","observe","element","show","display","hide","destroy","disconnect","remove","updatePosition","getRectFn"],"mappings":"AAgBgB,SAAAA,EACfC,EACAC,GAEA,MAAMC,EAAUC,SAASC,cAAc,OACvCF,EAAQG,MAAMC,QAAU,mDACxBJ,EAAQK,YAAYP,GACpBG,SAASK,KAAKD,YAAYL,GAE1B,IAAIO,EAA8CR,EAElD,SAASS,IACR,MAAMC,EAAOF,aAAA,EAAAA,IACb,IAAKE,EAAM,OAEX,MAAMC,EAAcV,EAAQW,aACtBC,EAAaZ,EAAQa,YACrBC,EAAYC,OAAOC,YACnBC,EAAYF,OAAOG,WAEnBC,EAAaL,EAAYL,EAAKW,OA9B1B,EA+BJC,EAAaZ,EAAKa,IA/Bd,EAkCJA,EAFYH,GAAcT,EAG7BD,EAAKW,OAnCE,EAoCPC,GAAcX,EACdD,EAAKa,IArCE,EAqCUZ,EArCV,EAwCJa,EAAOC,KAAKC,IAAIhB,EAAKc,KAAMN,EAAYL,EAxCnC,GA0CVZ,EAAQG,MAAMoB,KAAU,GAAAC,KAAKE,IA1CnB,EA0C4BH,OACtCvB,EAAQG,MAAMmB,IAAS,GAAAA,KACxB,CAEA,MAAMK,EAAW,IAAIC,eAAepB,GAKpC,OAJAmB,EAASE,QAAQ7B,GAEjBQ,IAEO,CACNsB,QAAS9B,EACT+B,OACC/B,EAAQG,MAAM6B,QAAU,EACxB,EACDC,OACCjC,EAAQG,MAAM6B,QAAU,MACxB,EACDE,UACCP,EAASQ,aACTnC,EAAQoC,QACR,EACDC,eAAeC,GACd/B,EAAe+B,EACf9B,GACD,EAEF"}
|