@yoopta/ui 6.0.0-beta.12 → 6.0.0-beta.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/action-menu-list.js +1 -1
- package/dist/action-menu-list.js.map +1 -0
- package/dist/block-dnd.js.map +1 -0
- package/dist/block-options.js +1 -1
- package/dist/block-options.js.map +1 -0
- package/dist/chunks/_tslib-8f8de673.js +36 -0
- package/dist/chunks/_tslib-8f8de673.js.map +1 -0
- package/dist/chunks/floating-ui.react-b048728e.js +5 -0
- package/dist/chunks/floating-ui.react-d2303b03.js +4506 -0
- package/dist/chunks/floating-ui.react-d2303b03.js.map +1 -0
- package/dist/chunks/floating-ui.react-feaab622.js +4506 -0
- package/dist/chunks/floating-ui.react-feaab622.js.map +1 -0
- package/dist/chunks/highlight-color-picker-027fa4b4.js +93 -0
- package/dist/chunks/highlight-color-picker-027fa4b4.js.map +1 -0
- package/dist/chunks/highlight-color-picker-a1a292a9.js +1 -0
- package/dist/chunks/highlight-color-picker-a979e7a3.js +93 -0
- package/dist/chunks/highlight-color-picker-a979e7a3.js.map +1 -0
- package/dist/chunks/index-bfd2e7c4.js +6 -0
- package/dist/chunks/index-bfd2e7c4.js.map +1 -0
- package/dist/chunks/style-inject.es-746bb8ed.js +29 -0
- package/dist/chunks/style-inject.es-746bb8ed.js.map +1 -0
- package/dist/chunks/throttle-278836f4.js +45 -0
- package/dist/chunks/throttle-278836f4.js.map +1 -0
- package/dist/element-options.js +18 -5
- package/dist/element-options.js.map +1 -0
- package/dist/floating-block-actions.js.map +1 -0
- package/dist/floating-toolbar/floating-toolbar.d.ts +4 -4
- package/dist/floating-toolbar/floating-toolbar.d.ts.map +1 -1
- package/dist/floating-toolbar.js +1 -1
- package/dist/floating-toolbar.js.map +1 -0
- package/dist/highlight-color-picker.js +1 -1
- package/dist/highlight-color-picker.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -0
- package/dist/overlay.js +1 -1
- package/dist/overlay.js.map +1 -0
- package/dist/portal/Portal.d.ts.map +1 -1
- package/dist/portal.js +1 -1
- package/dist/portal.js.map +1 -0
- package/dist/selection-box.js.map +1 -0
- package/dist/slash-command-menu.js +1 -1
- package/dist/slash-command-menu.js.map +1 -0
- package/package.json +2 -2
package/dist/element-options.js
CHANGED
|
@@ -1,14 +1,27 @@
|
|
|
1
|
-
import{s as e}from"./chunks/style-inject.es-e87a8d02.js";import{jsxs as t,Fragment as o,jsx as n}from"react/jsx-runtime";import{useState as a,useRef as r,useEffect as s,createContext as l,useContext as i,useMemo as d,forwardRef as c,createElement as p}from"react";import{u as m,o as u,f as g,s as b,a as f}from"./chunks/floating-ui.react-727e4287.js";import{Z as h}from"./chunks/index-e0185864.js";import{Portal as x}from"./portal.js";import{Elements as y,useYooptaEditor as k}from"@yoopta/editor";import"react-dom";e('[data-element-options-root]{position:relative}[data-element-options-trigger]{align-items:center;background:transparent;border:none;border-radius:4px;cursor:pointer;display:inline-flex;justify-content:center;padding:4px;transition:background-color .15s ease,opacity .15s ease}[data-element-options-trigger]:hover{background-color:rgba(0,0,0,.05)}[data-element-options-trigger]:focus-visible{outline:2px solid rgba(59,130,246,.5);outline-offset:2px}.yoo-element-options-trigger-icon{color:#6b7280;height:16px;width:16px}[data-element-options-content]{background-color:#fff;border:1px solid #e5e7eb;border-radius:8px;box-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);min-width:180px;padding:8px;z-index:50}[data-element-options-group]{display:flex;flex-direction:column;gap:6px}[data-element-options-group]+[data-element-options-group]{margin-top:8px}[data-element-options-label]{color:#6b7280;font-size:12px;font-weight:500}[data-element-options-separator]{background-color:#e5e7eb;height:1px;margin:8px 0}[data-element-options-select]{align-items:center;background-color:#fff;border:1px solid #e5e7eb;border-radius:6px;cursor:pointer;display:flex;font-size:13px;justify-content:space-between;padding:6px 10px;transition:border-color .15s ease;width:100%}[data-element-options-select]:hover{border-color:#d1d5db}[data-element-options-select]:focus-visible{outline:2px solid rgba(59,130,246,.5);outline-offset:2px}[data-element-options-select-value]{align-items:center;display:flex;gap:8px}[data-element-options-select-chevron]{color:#9ca3af;height:14px;transition:transform .15s ease;width:14px}[data-element-options-select][data-state=open] [data-element-options-select-chevron]{transform:rotate(180deg)}[data-element-options-select-content]{background-color:#fff;border:1px solid #e5e7eb;border-radius:6px;box-shadow:0 4px 6px -1px rgba(0,0,0,.1);min-width:140px;padding:4px;z-index:51}[data-element-options-select-item]{align-items:center;background:transparent;border:none;border-radius:4px;cursor:pointer;display:flex;font-size:13px;justify-content:space-between;padding:6px 8px;text-align:left;transition:background-color .15s ease;width:100%}[data-element-options-select-item]:hover{background-color:#f3f4f6}[data-element-options-select-item][data-selected=true]{background-color:#eff6ff}[data-element-options-select-item-content]{align-items:center;display:flex;gap:8px}[data-element-options-select-check]{color:#3b82f6;height:14px;width:14px}[data-element-options-select-icon]{align-items:center;display:flex;height:16px;justify-content:center;width:16px}[data-element-options-select-color]{border:1px solid rgba(0,0,0,.1);border-radius:50%;display:inline-block;height:12px;width:12px}[data-element-options-color-picker]{align-items:center;background-color:#fff;border:1px solid #e5e7eb;border-radius:6px;cursor:pointer;display:flex;font-size:13px;gap:8px;padding:6px 10px;transition:border-color .15s ease;width:100%}[data-element-options-color-picker]:hover{border-color:#d1d5db}[data-element-options-color-preview]{border:1px solid rgba(0,0,0,.1);border-radius:4px;display:inline-block;height:20px;width:20px}[data-element-options-color-value]{color:#6b7280;font-family:monospace;font-size:12px}[data-element-options-color-picker-content]{background-color:#fff;border:1px solid #e5e7eb;border-radius:8px;box-shadow:0 4px 6px -1px rgba(0,0,0,.1);padding:12px;z-index:51}[data-element-options-color-picker-content] .react-colorful{height:150px;width:180px}[data-element-options-color-presets]{border-top:1px solid #e5e7eb;display:flex;flex-wrap:wrap;gap:6px;margin-top:10px;padding-top:10px}[data-element-options-color-preset]{border:2px solid transparent;border-radius:4px;cursor:pointer;height:20px;padding:0;transition:border-color .15s ease,transform .15s ease;width:20px}[data-element-options-color-preset]:hover{transform:scale(1.1)}[data-element-options-color-preset][data-selected=true]{border-color:#3b82f6}[data-element-options-toggle]{align-items:center;background:transparent;border:none;cursor:pointer;display:inline-flex;gap:8px;padding:0}[data-element-options-toggle-thumb]{background-color:#e5e7eb;border-radius:10px;height:20px;position:relative;transition:background-color .2s ease;width:36px}[data-element-options-toggle-thumb]:after{background-color:#fff;border-radius:50%;box-shadow:0 1px 3px rgba(0,0,0,.1);content:"";height:16px;left:2px;position:absolute;top:2px;transition:transform .2s ease;width:16px}[data-element-options-toggle][data-state=checked] [data-element-options-toggle-thumb]{background-color:#3b82f6}[data-element-options-toggle][data-state=checked] [data-element-options-toggle-thumb]:after{transform:translateX(16px)}[data-element-options-toggle-label]{color:#374151;font-size:13px}[data-element-options-slider]{align-items:center;display:flex;gap:10px}[data-element-options-slider-input]{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:linear-gradient(to right,#3b82f6 0,#3b82f6 var(--slider-percentage,0),#e5e7eb var(--slider-percentage,0),#e5e7eb 100%);border-radius:2px;cursor:pointer;flex:1;height:4px}[data-element-options-slider-input]::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;background-color:#fff;border:2px solid #3b82f6;border-radius:50%;cursor:pointer;height:14px;-webkit-transition:transform .15s ease;transition:transform .15s ease;width:14px}[data-element-options-slider-input]::-webkit-slider-thumb:hover{transform:scale(1.1)}[data-element-options-slider-value]{color:#6b7280;font-family:monospace;font-size:12px;min-width:32px;text-align:right}[data-element-options-input]{background-color:#fff;border:1px solid #e5e7eb;border-radius:6px;font-size:13px;padding:6px 10px;transition:border-color .15s ease;width:100%}[data-element-options-input]:hover{border-color:#d1d5db}[data-element-options-input]:focus{border-color:#3b82f6;box-shadow:0 0 0 2px rgba(59,130,246,.1);outline:none}[data-element-options-input]::-moz-placeholder{color:#9ca3af}[data-element-options-input]::placeholder{color:#9ca3af}@media (prefers-color-scheme:dark){[data-element-options-color-picker-content],[data-element-options-content],[data-element-options-select-content]{background-color:#1f2937;border-color:#374151}[data-element-options-label]{color:#9ca3af}[data-element-options-separator]{background-color:#374151}[data-element-options-color-picker],[data-element-options-input],[data-element-options-select]{background-color:#1f2937;border-color:#374151;color:#f3f4f6}[data-element-options-color-picker]:hover,[data-element-options-input]:hover,[data-element-options-select]:hover{border-color:#4b5563}[data-element-options-select-item]:hover{background-color:#374151}[data-element-options-select-item][data-selected=true]{background-color:rgba(59,130,246,.2)}[data-element-options-color-presets]{border-top-color:#374151}[data-element-options-toggle-thumb]{background-color:#374151}[data-element-options-toggle-label]{color:#d1d5db}[data-element-options-slider-input]{background:linear-gradient(to right,#3b82f6 0,#3b82f6 var(--slider-percentage,0),#374151 var(--slider-percentage,0),#374151 100%)}.yoo-element-options-trigger-icon{color:#9ca3af}[data-element-options-trigger]:hover{background-color:hsla(0,0%,100%,.1)}}');const v=["#000000","#6B7280","#EF4444","#F59E0B","#22C55E","#3B82F6","#8B5CF6","#EC4899"],w=({value:e,onChange:l,presetColors:i=v,className:d,style:c})=>{const[p,y]=a(!1),k=r(null),{refs:w,floatingStyles:O}=m({open:p,placement:"bottom-start",middleware:[u(4),g({padding:8}),b({padding:8})],whileElementsMounted:f});s(()=>{k.current&&w.setReference(k.current)},[w]),s(()=>{if(!p)return;const e=e=>{const t=e.target;k.current&&!k.current.contains(t)&&w.floating.current&&!w.floating.current.contains(t)&&y(!1)},t=e=>{"Escape"===e.key&&y(!1)};return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)}},[p,w.floating]);const j=e=>{e.preventDefault()};return t(o,{children:[t("button",Object.assign({ref:k,type:"button",className:d,style:c,onClick:e=>{e.preventDefault(),e.stopPropagation(),y(!p)},onMouseDown:j,"data-element-options-color-picker":!0,"data-state":p?"open":"closed","aria-expanded":p},{children:[n("span",{"data-element-options-color-preview":!0,style:{backgroundColor:e}}),n("span",Object.assign({"data-element-options-color-value":!0},{children:e}))]})),p&&n(x,Object.assign({id:"element-options-color-picker-portal"},{children:t("div",Object.assign({ref:w.setFloating,style:O,"data-element-options-color-picker-content":!0,onMouseDown:j},{children:[n(h,{color:e,onChange:l}),i.length>0&&n("div",Object.assign({"data-element-options-color-presets":!0},{children:i.map(t=>n("button",{type:"button","data-element-options-color-preset":!0,"data-selected":t===e,style:{backgroundColor:t},onClick:()=>(e=>{l(e)})(t),onMouseDown:j,"aria-label":`Select color ${t}`},t))}))]}))}))]})};w.displayName="ElementOptions.ColorPicker";const O=l(null);function j(){const e=i(O);if(!e)throw new Error("useElementOptionsContext must be used within an ElementOptions.Root");return e}function N(){const{blockId:e,element:t,editor:o,isOpen:n,setIsOpen:a}=j();return{blockId:e,element:t,editor:o,isOpen:n,setIsOpen:a}}function E(){const{blockId:e,element:t,editor:o}=j();return n=>{y.updateElement(o,{blockId:e,type:t.type,props:Object.assign(Object.assign({},t.props),n)})}}O.displayName="ElementOptionsContext";const C=({children:e,className:t,style:o,side:a="bottom",align:l="end",sideOffset:i=4,alignOffset:d=0})=>{const{isOpen:c,setIsOpen:p,triggerRef:h,contentRef:y}=j(),k=r(null),v="center"===l?a:`${a}-${l}`,{refs:w,floatingStyles:O}=m({open:c,placement:v,middleware:[u({mainAxis:i,crossAxis:d}),g({padding:8}),b({padding:8})],whileElementsMounted:f});return s(()=>{h.current&&w.setReference(h.current)},[h,w]),s(()=>{if(!c)return;const e=e=>{const t=e.target,o=h.current,n=k.current;o&&!o.contains(t)&&n&&!n.contains(t)&&p(!1)},t=e=>{"Escape"===e.key&&p(!1)};return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)}},[c,p,h]),c?n(x,Object.assign({id:"element-options-portal"},{children:n("div",Object.assign({ref:e=>{w.setFloating(e),k.current=e,y&&(y.current=e)},className:t,style:Object.assign(Object.assign({},O),o),"data-element-options-content":!0,"data-state":"open","data-side":a,"data-align":l,role:"dialog","aria-modal":"true"},{children:e}))})):null};C.displayName="ElementOptions.Content";const D=({children:e,className:t,style:o})=>n("div",Object.assign({className:t,style:o,"data-element-options-group":!0},{children:e}));D.displayName="ElementOptions.Group";const z=({value:e,onChange:t,placeholder:o,type:a="text",className:r,style:s})=>n("input",{type:a,value:e,onChange:e=>{t(e.target.value)},onMouseDown:e=>{e.stopPropagation()},placeholder:o,className:r,style:s,"data-element-options-input":!0});z.displayName="ElementOptions.Input";const L=({children:e,className:t,style:o})=>n("label",Object.assign({className:t,style:o,"data-element-options-label":!0},{children:e}));L.displayName="ElementOptions.Label";const M=({blockId:e,element:t,children:o,anchorRef:s,className:l,style:i})=>{const c=k(),[p,m]=a(!1),u=r(null),g=r(null),b=d(()=>({blockId:e,element:t,editor:c,isOpen:p,setIsOpen:m,triggerRef:u,contentRef:g,anchorRef:null!=s?s:null}),[e,t,c,p,s]);return n(O.Provider,Object.assign({value:b},{children:n("div",Object.assign({className:l,style:i,"data-element-options-root":!0,"data-state":p?"open":"closed"},{children:o}))}))};M.displayName="ElementOptions.Root";
|
|
1
|
+
import{s as e}from"./chunks/style-inject.es-e87a8d02.js";import{jsxs as t,Fragment as o,jsx as n}from"react/jsx-runtime";import{useState as a,useRef as r,useEffect as s,createContext as l,useContext as i,useMemo as d,forwardRef as c,createElement as p}from"react";import{u as m,o as u,f as g,s as b,a as f}from"./chunks/floating-ui.react-b048728e.js";import{Z as h}from"./chunks/index-e0185864.js";import{Portal as x}from"./portal.js";import{Elements as y,useYooptaEditor as k}from"@yoopta/editor";import"react-dom";e('[data-element-options-root]{position:relative}[data-element-options-trigger]{align-items:center;background:transparent;border:none;border-radius:4px;cursor:pointer;display:inline-flex;justify-content:center;padding:4px;transition:background-color .15s ease,opacity .15s ease}[data-element-options-trigger]:hover{background-color:rgba(0,0,0,.05)}[data-element-options-trigger]:focus-visible{outline:2px solid rgba(59,130,246,.5);outline-offset:2px}.yoo-element-options-trigger-icon{color:#6b7280;height:16px;width:16px}[data-element-options-content]{background-color:#fff;border:1px solid #e5e7eb;border-radius:8px;box-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);min-width:180px;padding:8px;z-index:50}[data-element-options-group]{display:flex;flex-direction:column;gap:6px}[data-element-options-group]+[data-element-options-group]{margin-top:8px}[data-element-options-label]{color:#6b7280;font-size:12px;font-weight:500}[data-element-options-separator]{background-color:#e5e7eb;height:1px;margin:8px 0}[data-element-options-select]{align-items:center;background-color:#fff;border:1px solid #e5e7eb;border-radius:6px;cursor:pointer;display:flex;font-size:13px;justify-content:space-between;padding:6px 10px;transition:border-color .15s ease;width:100%}[data-element-options-select]:hover{border-color:#d1d5db}[data-element-options-select]:focus-visible{outline:2px solid rgba(59,130,246,.5);outline-offset:2px}[data-element-options-select-value]{align-items:center;display:flex;gap:8px}[data-element-options-select-chevron]{color:#9ca3af;height:14px;transition:transform .15s ease;width:14px}[data-element-options-select][data-state=open] [data-element-options-select-chevron]{transform:rotate(180deg)}[data-element-options-select-content]{background-color:#fff;border:1px solid #e5e7eb;border-radius:6px;box-shadow:0 4px 6px -1px rgba(0,0,0,.1);min-width:140px;padding:4px;z-index:51}[data-element-options-select-item]{align-items:center;background:transparent;border:none;border-radius:4px;cursor:pointer;display:flex;font-size:13px;justify-content:space-between;padding:6px 8px;text-align:left;transition:background-color .15s ease;width:100%}[data-element-options-select-item]:hover{background-color:#f3f4f6}[data-element-options-select-item][data-selected=true]{background-color:#eff6ff}[data-element-options-select-item-content]{align-items:center;display:flex;gap:8px}[data-element-options-select-check]{color:#3b82f6;height:14px;width:14px}[data-element-options-select-icon]{align-items:center;display:flex;height:16px;justify-content:center;width:16px}[data-element-options-select-color]{border:1px solid rgba(0,0,0,.1);border-radius:50%;display:inline-block;height:12px;width:12px}[data-element-options-color-picker]{align-items:center;background-color:#fff;border:1px solid #e5e7eb;border-radius:6px;cursor:pointer;display:flex;font-size:13px;gap:8px;padding:6px 10px;transition:border-color .15s ease;width:100%}[data-element-options-color-picker]:hover{border-color:#d1d5db}[data-element-options-color-preview]{border:1px solid rgba(0,0,0,.1);border-radius:4px;display:inline-block;height:20px;width:20px}[data-element-options-color-value]{color:#6b7280;font-family:monospace;font-size:12px}[data-element-options-color-picker-content]{background-color:#fff;border:1px solid #e5e7eb;border-radius:8px;box-shadow:0 4px 6px -1px rgba(0,0,0,.1);padding:12px;z-index:51}[data-element-options-color-picker-content] .react-colorful{height:150px;width:180px}[data-element-options-color-presets]{border-top:1px solid #e5e7eb;display:flex;flex-wrap:wrap;gap:6px;margin-top:10px;padding-top:10px}[data-element-options-color-preset]{border:2px solid transparent;border-radius:4px;cursor:pointer;height:20px;padding:0;transition:border-color .15s ease,transform .15s ease;width:20px}[data-element-options-color-preset]:hover{transform:scale(1.1)}[data-element-options-color-preset][data-selected=true]{border-color:#3b82f6}[data-element-options-toggle]{align-items:center;background:transparent;border:none;cursor:pointer;display:inline-flex;gap:8px;padding:0}[data-element-options-toggle-thumb]{background-color:#e5e7eb;border-radius:10px;height:20px;position:relative;transition:background-color .2s ease;width:36px}[data-element-options-toggle-thumb]:after{background-color:#fff;border-radius:50%;box-shadow:0 1px 3px rgba(0,0,0,.1);content:"";height:16px;left:2px;position:absolute;top:2px;transition:transform .2s ease;width:16px}[data-element-options-toggle][data-state=checked] [data-element-options-toggle-thumb]{background-color:#3b82f6}[data-element-options-toggle][data-state=checked] [data-element-options-toggle-thumb]:after{transform:translateX(16px)}[data-element-options-toggle-label]{color:#374151;font-size:13px}[data-element-options-slider]{align-items:center;display:flex;gap:10px}[data-element-options-slider-input]{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:linear-gradient(to right,#3b82f6 0,#3b82f6 var(--slider-percentage,0),#e5e7eb var(--slider-percentage,0),#e5e7eb 100%);border-radius:2px;cursor:pointer;flex:1;height:4px}[data-element-options-slider-input]::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;background-color:#fff;border:2px solid #3b82f6;border-radius:50%;cursor:pointer;height:14px;-webkit-transition:transform .15s ease;transition:transform .15s ease;width:14px}[data-element-options-slider-input]::-webkit-slider-thumb:hover{transform:scale(1.1)}[data-element-options-slider-value]{color:#6b7280;font-family:monospace;font-size:12px;min-width:32px;text-align:right}[data-element-options-input]{background-color:#fff;border:1px solid #e5e7eb;border-radius:6px;font-size:13px;padding:6px 10px;transition:border-color .15s ease;width:100%}[data-element-options-input]:hover{border-color:#d1d5db}[data-element-options-input]:focus{border-color:#3b82f6;box-shadow:0 0 0 2px rgba(59,130,246,.1);outline:none}[data-element-options-input]::-moz-placeholder{color:#9ca3af}[data-element-options-input]::placeholder{color:#9ca3af}@media (prefers-color-scheme:dark){[data-element-options-color-picker-content],[data-element-options-content],[data-element-options-select-content]{background-color:#1f2937;border-color:#374151}[data-element-options-label]{color:#9ca3af}[data-element-options-separator]{background-color:#374151}[data-element-options-color-picker],[data-element-options-input],[data-element-options-select]{background-color:#1f2937;border-color:#374151;color:#f3f4f6}[data-element-options-color-picker]:hover,[data-element-options-input]:hover,[data-element-options-select]:hover{border-color:#4b5563}[data-element-options-select-item]:hover{background-color:#374151}[data-element-options-select-item][data-selected=true]{background-color:rgba(59,130,246,.2)}[data-element-options-color-presets]{border-top-color:#374151}[data-element-options-toggle-thumb]{background-color:#374151}[data-element-options-toggle-label]{color:#d1d5db}[data-element-options-slider-input]{background:linear-gradient(to right,#3b82f6 0,#3b82f6 var(--slider-percentage,0),#374151 var(--slider-percentage,0),#374151 100%)}.yoo-element-options-trigger-icon{color:#9ca3af}[data-element-options-trigger]:hover{background-color:hsla(0,0%,100%,.1)}}');const v=["#000000","#6B7280","#EF4444","#F59E0B","#22C55E","#3B82F6","#8B5CF6","#EC4899"],w=({value:e,onChange:l,presetColors:i=v,className:d,style:c})=>{const[p,y]=a(!1),k=r(null),{refs:w,floatingStyles:O}=m({open:p,placement:"bottom-start",middleware:[u(4),g({padding:8}),b({padding:8})],whileElementsMounted:f});s(()=>{k.current&&w.setReference(k.current)},[w]),s(()=>{if(!p)return;const e=e=>{const t=e.target;k.current&&!k.current.contains(t)&&w.floating.current&&!w.floating.current.contains(t)&&y(!1)},t=e=>{"Escape"===e.key&&y(!1)};return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)}},[p,w.floating]);const N=e=>{e.preventDefault()};return t(o,{children:[t("button",Object.assign({ref:k,type:"button",className:d,style:c,onClick:e=>{e.preventDefault(),e.stopPropagation(),y(!p)},onMouseDown:N,"data-element-options-color-picker":!0,"data-state":p?"open":"closed","aria-expanded":p},{children:[n("span",{"data-element-options-color-preview":!0,style:{backgroundColor:e}}),n("span",Object.assign({"data-element-options-color-value":!0},{children:e}))]})),p&&n(x,Object.assign({id:"element-options-color-picker-portal"},{children:t("div",Object.assign({ref:w.setFloating,style:O,"data-element-options-color-picker-content":!0,onMouseDown:N},{children:[n(h,{color:e,onChange:l}),i.length>0&&n("div",Object.assign({"data-element-options-color-presets":!0},{children:i.map(t=>n("button",{type:"button","data-element-options-color-preset":!0,"data-selected":t===e,style:{backgroundColor:t},onClick:()=>(e=>{l(e)})(t),onMouseDown:N,"aria-label":`Select color ${t}`},t))}))]}))}))]})};w.displayName="ElementOptions.ColorPicker";const O=l(null);function N(){const e=i(O);if(!e)throw new Error("useElementOptionsContext must be used within an ElementOptions.Root");return e}function j(){const{blockId:e,element:t,editor:o,isOpen:n,setIsOpen:a}=N();return{blockId:e,element:t,editor:o,isOpen:n,setIsOpen:a}}function E(){const{blockId:e,element:t,editor:o}=N();return n=>{y.updateElement(o,{blockId:e,type:t.type,props:Object.assign(Object.assign({},t.props),n)})}}O.displayName="ElementOptionsContext";const C=({children:e,className:t,style:o,side:a="bottom",align:l="end",sideOffset:i=4,alignOffset:d=0})=>{const{isOpen:c,setIsOpen:p,triggerRef:h,contentRef:y}=N(),k=r(null),v="center"===l?a:`${a}-${l}`,{refs:w,floatingStyles:O}=m({open:c,placement:v,middleware:[u({mainAxis:i,crossAxis:d}),g({padding:8}),b({padding:8})],whileElementsMounted:f});return s(()=>{h.current&&w.setReference(h.current)},[h,w]),s(()=>{if(!c)return;const e=e=>{const t=e.target,o=h.current,n=k.current;o&&!o.contains(t)&&n&&!n.contains(t)&&p(!1)},t=e=>{"Escape"===e.key&&p(!1)};return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)}},[c,p,h]),c?n(x,Object.assign({id:"element-options-portal"},{children:n("div",Object.assign({ref:e=>{w.setFloating(e),k.current=e,y&&(y.current=e)},className:t,style:Object.assign(Object.assign({},O),o),"data-element-options-content":!0,"data-state":"open","data-side":a,"data-align":l,role:"dialog","aria-modal":"true"},{children:e}))})):null};C.displayName="ElementOptions.Content";const D=({children:e,className:t,style:o})=>n("div",Object.assign({className:t,style:o,"data-element-options-group":!0},{children:e}));D.displayName="ElementOptions.Group";const z=({value:e,onChange:t,placeholder:o,type:a="text",className:r,style:s})=>n("input",{type:a,value:e,onChange:e=>{t(e.target.value)},onMouseDown:e=>{e.stopPropagation()},placeholder:o,className:r,style:s,"data-element-options-input":!0});z.displayName="ElementOptions.Input";const L=({children:e,className:t,style:o})=>n("label",Object.assign({className:t,style:o,"data-element-options-label":!0},{children:e}));L.displayName="ElementOptions.Label";const R=({blockId:e,element:t,children:o,anchorRef:s,className:l,style:i})=>{const c=k(),[p,m]=a(!1),u=r(null),g=r(null),b=d(()=>({blockId:e,element:t,editor:c,isOpen:p,setIsOpen:m,triggerRef:u,contentRef:g,anchorRef:null!=s?s:null}),[e,t,c,p,s]);return n(O.Provider,Object.assign({value:b},{children:n("div",Object.assign({className:l,style:i,"data-element-options-root":!0,"data-state":p?"open":"closed"},{children:o}))}))};R.displayName="ElementOptions.Root";
|
|
2
2
|
/**
|
|
3
|
-
* @license lucide-react v0.
|
|
3
|
+
* @license lucide-react v0.378.0 - ISC
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the ISC license.
|
|
6
6
|
* See the LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
|
-
|
|
8
|
+
const I=(...e)=>e.filter((e,t,o)=>Boolean(e)&&o.indexOf(e)===t).join(" ");
|
|
9
9
|
/**
|
|
10
|
-
* @license lucide-react v0.
|
|
10
|
+
* @license lucide-react v0.378.0 - ISC
|
|
11
11
|
*
|
|
12
12
|
* This source code is licensed under the ISC license.
|
|
13
13
|
* See the LICENSE file in the root directory of this source tree.
|
|
14
|
-
*/
|
|
14
|
+
*/
|
|
15
|
+
var M={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};
|
|
16
|
+
/**
|
|
17
|
+
* @license lucide-react v0.378.0 - ISC
|
|
18
|
+
*
|
|
19
|
+
* This source code is licensed under the ISC license.
|
|
20
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
+
*/const S=c(({color:e="currentColor",size:t=24,strokeWidth:o=2,absoluteStrokeWidth:n,className:a="",children:r,iconNode:s,...l},i)=>p("svg",{ref:i,...M,width:t,height:t,stroke:e,strokeWidth:n?24*Number(o)/Number(t):o,className:I("lucide",a),...l},[...s.map(([e,t])=>p(e,t)),...Array.isArray(r)?r:[r]])),$=(e,t)=>{const o=c(({className:o,...n},a)=>{return p(S,{ref:a,iconNode:t,className:I(`lucide-${r=e,r.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,o),...n});var r});return o.displayName=`${e}`,o},P=$("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),F=$("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),A=$("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]),B=({value:e,options:l,onValueChange:i,placeholder:d="Select...",className:c,style:p,renderOption:h,renderValue:y})=>{const[k,v]=a(!1),w=r(null),O=l.find(t=>t.value===e),{refs:N,floatingStyles:j}=m({open:k,placement:"bottom-start",middleware:[u(4),g({padding:8}),b({padding:8})],whileElementsMounted:f});s(()=>{w.current&&N.setReference(w.current)},[N]),s(()=>{if(!k)return;const e=e=>{const t=e.target;w.current&&!w.current.contains(t)&&N.floating.current&&!N.floating.current.contains(t)&&v(!1)},t=e=>{"Escape"===e.key&&v(!1)};return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)}},[k,N.floating]);const E=e=>{e.preventDefault()},C=e=>t(o,{children:[e.icon&&n("span",Object.assign({"data-element-options-select-icon":!0},{children:e.icon})),e.color&&n("span",{"data-element-options-select-color":!0,style:{backgroundColor:e.color}}),n("span",{children:e.label})]});return t(o,{children:[t("button",Object.assign({ref:w,type:"button",className:c,style:p,onClick:e=>{e.preventDefault(),e.stopPropagation(),v(!k)},onMouseDown:E,"data-element-options-select":!0,"data-state":k?"open":"closed","aria-expanded":k,"aria-haspopup":"listbox"},{children:[n("span",Object.assign({"data-element-options-select-value":!0},{children:y?y(O):(D=O,t(o,{children:[(null==D?void 0:D.icon)&&n("span",Object.assign({"data-element-options-select-icon":!0},{children:D.icon})),(null==D?void 0:D.color)&&n("span",{"data-element-options-select-color":!0,style:{backgroundColor:D.color}}),n("span",{children:null!==(z=null==D?void 0:D.label)&&void 0!==z?z:d})]}))})),n(F,{"data-element-options-select-chevron":!0})]})),k&&n(x,Object.assign({id:"element-options-select-portal"},{children:n("div",Object.assign({ref:N.setFloating,style:j,"data-element-options-select-content":!0,role:"listbox","aria-activedescendant":e,tabIndex:0},{children:l.map(o=>t("button",Object.assign({type:"button",role:"option","aria-selected":o.value===e,"data-element-options-select-item":!0,"data-selected":o.value===e,onClick:()=>{return e=o.value,i(e),void v(!1);var e},onMouseDown:E},{children:[n("span",Object.assign({"data-element-options-select-item-content":!0},{children:h?h(o):C(o)})),o.value===e&&n(P,{"data-element-options-select-check":!0})]}),String(o.value)))}))}))]});var D,z};
|
|
22
|
+
/**
|
|
23
|
+
* @license lucide-react v0.378.0 - ISC
|
|
24
|
+
*
|
|
25
|
+
* This source code is licensed under the ISC license.
|
|
26
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
27
|
+
*/B.displayName="ElementOptions.Select";const T=({className:e,style:t})=>n("div",{className:e,style:t,"data-element-options-separator":!0,role:"separator","aria-orientation":"horizontal"});T.displayName="ElementOptions.Separator";const W=({value:e,onValueChange:o,min:a=0,max:r=100,step:s=1,className:l,style:i})=>{const d=(e-a)/(r-a)*100;return t("div",Object.assign({className:l,style:i,"data-element-options-slider":!0,onMouseDown:e=>{e.stopPropagation()}},{children:[n("input",{type:"range",min:a,max:r,step:s,value:e,onChange:e=>{o(Number(e.target.value))},"data-element-options-slider-input":!0,style:{"--slider-percentage":`${d}%`}}),n("span",Object.assign({"data-element-options-slider-value":!0},{children:e}))]}))};W.displayName="ElementOptions.Slider";const V=({checked:e,onCheckedChange:o,label:a,className:r,style:s})=>t("button",Object.assign({type:"button",role:"switch","aria-checked":e,className:r,style:s,onClick:t=>{t.preventDefault(),t.stopPropagation(),o(!e)},onMouseDown:e=>{e.preventDefault()},onKeyDown:t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),o(!e))},"data-element-options-toggle":!0,"data-state":e?"checked":"unchecked"},{children:[n("span",{"data-element-options-toggle-thumb":!0}),a&&n("span",Object.assign({"data-element-options-toggle-label":!0},{children:a}))]}));V.displayName="ElementOptions.Toggle";const G=({children:e,className:t,style:o,side:a,align:r,sideOffset:l=0,alignOffset:i=0})=>{const{isOpen:d,setIsOpen:c,triggerRef:p,anchorRef:h}=N(),x=Boolean(h&&a),y=a?"center"!==r&&r?`${a}-${r}`:a:"bottom",{refs:k,floatingStyles:v}=m({placement:y,middleware:[u({mainAxis:l,crossAxis:i}),g({padding:8}),b({padding:8})],whileElementsMounted:f});s(()=>{(null==h?void 0:h.current)&&x&&k.setReference(h.current)},[h,k,x]);const w=x?Object.assign(Object.assign({},v),o):o;return n("button",Object.assign({ref:e=>{p.current=e,x&&k.setFloating(e)},type:"button",className:t,style:w,onClick:e=>{e.preventDefault(),e.stopPropagation(),c(!d)},onMouseDown:e=>{e.preventDefault()},"data-element-options-trigger":!0,"data-state":d?"open":"closed","aria-expanded":d,"aria-haspopup":"dialog"},{children:null!=e?e:n(A,{className:"yoo-element-options-trigger-icon"})}))};G.displayName="ElementOptions.Trigger";const q=Object.assign(R,{Root:R,Trigger:G,Content:C,Group:D,Label:L,Separator:T,Select:B,ColorPicker:w,Toggle:V,Slider:W,Input:z});export{q as ElementOptions,w as ElementOptionsColorPicker,C as ElementOptionsContent,O as ElementOptionsContext,D as ElementOptionsGroup,z as ElementOptionsInput,L as ElementOptionsLabel,R as ElementOptionsRoot,B as ElementOptionsSelect,T as ElementOptionsSeparator,W as ElementOptionsSlider,V as ElementOptionsToggle,G as ElementOptionsTrigger,j as useElementOptions,N as useElementOptionsContext,E as useUpdateElementProps};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"element-options.js","sources":["../src/element-options/components/element-options-color-picker.tsx","../src/element-options/context/element-options-context.tsx","../src/element-options/components/element-options-content.tsx","../src/element-options/components/element-options-group.tsx","../src/element-options/components/element-options-input.tsx","../src/element-options/components/element-options-label.tsx","../src/element-options/components/element-options-root.tsx","../../../../node_modules/shared/src/utils.ts","../../../../node_modules/lucide-react/src/defaultAttributes.ts","../../../../node_modules/lucide-react/src/Icon.ts","../../../../node_modules/lucide-react/src/createLucideIcon.ts","../../../../node_modules/lucide-react/src/icons/check.ts","../../../../node_modules/lucide-react/src/icons/chevron-down.ts","../../../../node_modules/lucide-react/src/icons/ellipsis.ts","../src/element-options/components/element-options-select.tsx","../src/element-options/components/element-options-separator.tsx","../src/element-options/components/element-options-slider.tsx","../src/element-options/components/element-options-toggle.tsx","../src/element-options/components/element-options-trigger.tsx","../src/element-options/index.ts"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\nimport {\n autoUpdate,\n flip,\n offset,\n shift,\n useFloating,\n} from '@floating-ui/react';\nimport { HexColorPicker } from 'react-colorful';\n\nimport { Portal } from '../../portal';\nimport type { ElementOptionsColorPickerProps } from '../types';\n\nconst DEFAULT_PRESET_COLORS = [\n '#000000',\n '#6B7280',\n '#EF4444',\n '#F59E0B',\n '#22C55E',\n '#3B82F6',\n '#8B5CF6',\n '#EC4899',\n];\n\nexport const ElementOptionsColorPicker = ({\n value,\n onChange,\n presetColors = DEFAULT_PRESET_COLORS,\n className,\n style,\n}: ElementOptionsColorPickerProps) => {\n const [isOpen, setIsOpen] = useState(false);\n const triggerRef = useRef<HTMLButtonElement>(null);\n\n const { refs, floatingStyles } = useFloating({\n open: isOpen,\n placement: 'bottom-start',\n middleware: [\n offset(4),\n flip({ padding: 8 }),\n shift({ padding: 8 }),\n ],\n whileElementsMounted: autoUpdate,\n });\n\n useEffect(() => {\n if (triggerRef.current) {\n refs.setReference(triggerRef.current);\n }\n }, [refs]);\n\n useEffect(() => {\n if (!isOpen) return;\n\n const handleClickOutside = (event: MouseEvent) => {\n const target = event.target as Node;\n if (\n triggerRef.current &&\n !triggerRef.current.contains(target) &&\n refs.floating.current &&\n !refs.floating.current.contains(target)\n ) {\n setIsOpen(false);\n }\n };\n\n const handleEscape = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n setIsOpen(false);\n }\n };\n\n document.addEventListener('mousedown', handleClickOutside);\n document.addEventListener('keydown', handleEscape);\n\n return () => {\n document.removeEventListener('mousedown', handleClickOutside);\n document.removeEventListener('keydown', handleEscape);\n };\n }, [isOpen, refs.floating]);\n\n const handleTriggerClick = (e: React.MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n setIsOpen(!isOpen);\n };\n\n const handleMouseDown = (e: React.MouseEvent) => {\n e.preventDefault();\n };\n\n const handlePresetClick = (color: string) => {\n onChange(color);\n };\n\n return (\n <>\n <button\n ref={triggerRef}\n type=\"button\"\n className={className}\n style={style}\n onClick={handleTriggerClick}\n onMouseDown={handleMouseDown}\n data-element-options-color-picker\n data-state={isOpen ? 'open' : 'closed'}\n aria-expanded={isOpen}>\n <span\n data-element-options-color-preview\n style={{ backgroundColor: value }}\n />\n <span data-element-options-color-value>{value}</span>\n </button>\n\n {isOpen && (\n <Portal id=\"element-options-color-picker-portal\">\n <div\n ref={refs.setFloating}\n style={floatingStyles}\n data-element-options-color-picker-content\n onMouseDown={handleMouseDown}>\n <HexColorPicker color={value} onChange={onChange} />\n\n {presetColors.length > 0 && (\n <div data-element-options-color-presets>\n {presetColors.map((color) => (\n <button\n key={color}\n type=\"button\"\n data-element-options-color-preset\n data-selected={color === value}\n style={{ backgroundColor: color }}\n onClick={() => handlePresetClick(color)}\n onMouseDown={handleMouseDown}\n aria-label={`Select color ${color}`}\n />\n ))}\n </div>\n )}\n </div>\n </Portal>\n )}\n </>\n );\n};\n\nElementOptionsColorPicker.displayName = 'ElementOptions.ColorPicker';\n\n","import { createContext, useContext } from 'react';\nimport { Elements } from '@yoopta/editor';\n\nimport type { ElementOptionsContextValue } from '../types';\n\nexport const ElementOptionsContext = createContext<ElementOptionsContextValue | null>(null);\nElementOptionsContext.displayName = 'ElementOptionsContext';\n\nexport function useElementOptionsContext(): ElementOptionsContextValue {\n const context = useContext(ElementOptionsContext);\n\n if (!context) {\n throw new Error('useElementOptionsContext must be used within an ElementOptions.Root');\n }\n\n return context;\n}\n\nexport function useElementOptions() {\n const { blockId, element, editor, isOpen, setIsOpen } = useElementOptionsContext();\n return { blockId, element, editor, isOpen, setIsOpen };\n}\n\nexport function useUpdateElementProps<T extends Record<string, unknown>>() {\n const { blockId, element, editor } = useElementOptionsContext();\n\n return (props: Partial<T>) => {\n Elements.updateElement(editor, {\n blockId,\n type: element.type,\n props: { ...element.props, ...props },\n });\n };\n}\n\n","import { useEffect, useRef } from 'react';\nimport {\n useFloating,\n offset,\n flip,\n shift,\n autoUpdate,\n type Placement,\n} from '@floating-ui/react';\n\nimport { Portal } from '../../portal';\nimport { useElementOptionsContext } from '../context/element-options-context';\nimport type { ElementOptionsContentProps } from '../types';\n\nexport const ElementOptionsContent = ({\n children,\n className,\n style,\n side = 'bottom',\n align = 'end',\n sideOffset = 4,\n alignOffset = 0,\n}: ElementOptionsContentProps) => {\n const { isOpen, setIsOpen, triggerRef, contentRef } = useElementOptionsContext();\n const internalContentRef = useRef<HTMLDivElement>(null);\n\n // Build placement string for floating-ui\n const placement: Placement = align === 'center' ? side : `${side}-${align}`;\n\n const { refs, floatingStyles } = useFloating({\n open: isOpen,\n placement,\n middleware: [\n offset({ mainAxis: sideOffset, crossAxis: alignOffset }),\n flip({ padding: 8 }),\n shift({ padding: 8 }),\n ],\n whileElementsMounted: autoUpdate,\n });\n\n // Sync trigger ref with floating-ui\n useEffect(() => {\n if (triggerRef.current) {\n refs.setReference(triggerRef.current);\n }\n }, [triggerRef, refs]);\n\n // Handle click outside\n useEffect(() => {\n if (!isOpen) return;\n\n const handleClickOutside = (event: MouseEvent) => {\n const target = event.target as Node;\n const triggerEl = triggerRef.current;\n const contentEl = internalContentRef.current;\n\n if (\n triggerEl &&\n !triggerEl.contains(target) &&\n contentEl &&\n !contentEl.contains(target)\n ) {\n setIsOpen(false);\n }\n };\n\n const handleEscape = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n setIsOpen(false);\n }\n };\n\n document.addEventListener('mousedown', handleClickOutside);\n document.addEventListener('keydown', handleEscape);\n\n return () => {\n document.removeEventListener('mousedown', handleClickOutside);\n document.removeEventListener('keydown', handleEscape);\n };\n }, [isOpen, setIsOpen, triggerRef]);\n\n if (!isOpen) return null;\n\n return (\n <Portal id=\"element-options-portal\">\n <div\n ref={(node) => {\n refs.setFloating(node);\n internalContentRef.current = node;\n if (contentRef) {\n (contentRef as React.MutableRefObject<HTMLDivElement | null>).current = node;\n }\n }}\n className={className}\n style={{ ...floatingStyles, ...style }}\n data-element-options-content\n data-state=\"open\"\n data-side={side}\n data-align={align}\n role=\"dialog\"\n aria-modal=\"true\">\n {children}\n </div>\n </Portal>\n );\n};\n\nElementOptionsContent.displayName = 'ElementOptions.Content';\n\n","import type { ElementOptionsGroupProps } from '../types';\n\nexport const ElementOptionsGroup = ({\n children,\n className,\n style,\n}: ElementOptionsGroupProps) => (\n <div className={className} style={style} data-element-options-group>\n {children}\n </div>\n);\n\nElementOptionsGroup.displayName = 'ElementOptions.Group';\n\n","import type { ElementOptionsInputProps } from '../types';\n\nexport const ElementOptionsInput = ({\n value,\n onChange,\n placeholder,\n type = 'text',\n className,\n style,\n}: ElementOptionsInputProps) => {\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n onChange(e.target.value);\n };\n\n const handleMouseDown = (e: React.MouseEvent) => {\n e.stopPropagation();\n };\n\n return (\n <input\n type={type}\n value={value}\n onChange={handleChange}\n onMouseDown={handleMouseDown}\n placeholder={placeholder}\n className={className}\n style={style}\n data-element-options-input\n />\n );\n};\n\nElementOptionsInput.displayName = 'ElementOptions.Input';\n\n","import type { ElementOptionsLabelProps } from '../types';\n\nexport const ElementOptionsLabel = ({\n children,\n className,\n style,\n}: ElementOptionsLabelProps) => (\n <label className={className} style={style} data-element-options-label>\n {children}\n </label>\n);\n\nElementOptionsLabel.displayName = 'ElementOptions.Label';\n\n","import { useMemo, useRef, useState } from 'react';\nimport { useYooptaEditor } from '@yoopta/editor';\n\nimport { ElementOptionsContext } from '../context/element-options-context';\nimport type { ElementOptionsRootProps } from '../types';\n\nexport const ElementOptionsRoot = ({\n blockId,\n element,\n children,\n anchorRef,\n className,\n style,\n}: ElementOptionsRootProps) => {\n const editor = useYooptaEditor();\n const [isOpen, setIsOpen] = useState(false);\n const triggerRef = useRef<HTMLButtonElement>(null);\n const contentRef = useRef<HTMLDivElement>(null);\n\n const contextValue = useMemo(\n () => ({\n blockId,\n element,\n editor,\n isOpen,\n setIsOpen,\n triggerRef,\n contentRef,\n anchorRef: anchorRef ?? null,\n }),\n [blockId, element, editor, isOpen, anchorRef],\n );\n\n return (\n <ElementOptionsContext.Provider value={contextValue}>\n <div\n className={className}\n style={style}\n data-element-options-root\n data-state={isOpen ? 'open' : 'closed'}>\n {children}\n </div>\n </ElementOptionsContext.Provider>\n );\n};\n\nElementOptionsRoot.displayName = 'ElementOptions.Root';\n","import { CamelToPascal } from './utility-types';\n\n/**\n * Converts string to kebab case\n *\n * @param {string} string\n * @returns {string} A kebabized string\n */\nexport const toKebabCase = (string: string) =>\n string.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();\n\n/**\n * Converts string to pascal case\n *\n * @param {string} string\n * @returns {string} A pascalized string\n */\nexport const toPascalCase = <T extends string>(string: T): CamelToPascal<T> => {\n const camelCase = string.replace(/^([A-Z])|[\\s-_]+(\\w)/g, (match, p1, p2) =>\n p2 ? p2.toUpperCase() : p1.toLowerCase(),\n );\n\n return (camelCase.charAt(0).toUpperCase() + camelCase.slice(1)) as CamelToPascal<T>;\n};\n\n/**\n * Merges classes into a single string\n *\n * @param {array} classes\n * @returns {string} A string of classes\n */\nexport const mergeClasses = <ClassType = string | undefined | null>(...classes: ClassType[]) =>\n classes\n .filter((className, index, array) => {\n return Boolean(className) && array.indexOf(className) === index;\n })\n .join(' ');\n","export default {\n xmlns: 'http://www.w3.org/2000/svg',\n width: 24,\n height: 24,\n viewBox: '0 0 24 24',\n fill: 'none',\n stroke: 'currentColor',\n strokeWidth: 2,\n strokeLinecap: 'round',\n strokeLinejoin: 'round',\n};\n","import { createElement, forwardRef } from 'react';\nimport defaultAttributes from './defaultAttributes';\nimport { IconNode, LucideProps } from './types';\nimport { mergeClasses } from '@lucide/shared';\n\ninterface IconComponentProps extends LucideProps {\n iconNode: IconNode;\n}\n\n/**\n * Lucide icon component\n *\n * @component Icon\n * @param {object} props\n * @param {string} props.color - The color of the icon\n * @param {number} props.size - The size of the icon\n * @param {number} props.strokeWidth - The stroke width of the icon\n * @param {boolean} props.absoluteStrokeWidth - Whether to use absolute stroke width\n * @param {string} props.className - The class name of the icon\n * @param {IconNode} props.children - The children of the icon\n * @param {IconNode} props.iconNode - The icon node of the icon\n *\n * @returns {ForwardRefExoticComponent} LucideIcon\n */\nconst Icon = forwardRef<SVGSVGElement, IconComponentProps>(\n (\n {\n color = 'currentColor',\n size = 24,\n strokeWidth = 2,\n absoluteStrokeWidth,\n className = '',\n children,\n iconNode,\n ...rest\n },\n ref,\n ) => {\n return createElement(\n 'svg',\n {\n ref,\n ...defaultAttributes,\n width: size,\n height: size,\n stroke: color,\n strokeWidth: absoluteStrokeWidth ? (Number(strokeWidth) * 24) / Number(size) : strokeWidth,\n className: mergeClasses('lucide', className),\n ...rest,\n },\n [\n ...iconNode.map(([tag, attrs]) => createElement(tag, attrs)),\n ...(Array.isArray(children) ? children : [children]),\n ],\n );\n },\n);\n\nexport default Icon;\n","import { createElement, forwardRef } from 'react';\nimport { mergeClasses, toKebabCase } from '@lucide/shared';\nimport { IconNode, LucideProps } from './types';\nimport Icon from './Icon';\n\n/**\n * Create a Lucide icon component\n * @param {string} iconName\n * @param {array} iconNode\n * @returns {ForwardRefExoticComponent} LucideIcon\n */\nconst createLucideIcon = (iconName: string, iconNode: IconNode) => {\n const Component = forwardRef<SVGSVGElement, LucideProps>(({ className, ...props }, ref) =>\n createElement(Icon, {\n ref,\n iconNode,\n className: mergeClasses(`lucide-${toKebabCase(iconName)}`, className),\n ...props,\n }),\n );\n\n Component.displayName = `${iconName}`;\n\n return Component;\n};\n\nexport default createLucideIcon;\n","import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Check\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview  - https://lucide.dev/icons/check\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst Check = createLucideIcon('Check', [['path', { d: 'M20 6 9 17l-5-5', key: '1gmf2c' }]]);\n\nexport default Check;\n","import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name ChevronDown\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview  - https://lucide.dev/icons/chevron-down\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst ChevronDown = createLucideIcon('ChevronDown', [\n ['path', { d: 'm6 9 6 6 6-6', key: 'qrunsl' }],\n]);\n\nexport default ChevronDown;\n","import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Ellipsis\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview  - https://lucide.dev/icons/ellipsis\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst Ellipsis = createLucideIcon('Ellipsis', [\n ['circle', { cx: '12', cy: '12', r: '1', key: '41hilf' }],\n ['circle', { cx: '19', cy: '12', r: '1', key: '1wjl8i' }],\n ['circle', { cx: '5', cy: '12', r: '1', key: '1pcz8c' }],\n]);\n\nexport default Ellipsis;\n","import { useEffect, useRef, useState } from 'react';\nimport {\n autoUpdate,\n flip,\n offset,\n shift,\n useFloating,\n} from '@floating-ui/react';\nimport { Check, ChevronDown } from 'lucide-react';\n\nimport { Portal } from '../../portal';\nimport type { ElementOptionsSelectProps, SelectOption } from '../types';\n\nexport const ElementOptionsSelect = <T extends string = string>({\n value,\n options,\n onValueChange,\n placeholder = 'Select...',\n className,\n style,\n renderOption,\n renderValue,\n}: ElementOptionsSelectProps<T>) => {\n const [isOpen, setIsOpen] = useState(false);\n const triggerRef = useRef<HTMLButtonElement>(null);\n\n const selectedOption = options.find((opt) => opt.value === value);\n\n const { refs, floatingStyles } = useFloating({\n open: isOpen,\n placement: 'bottom-start',\n middleware: [\n offset(4),\n flip({ padding: 8 }),\n shift({ padding: 8 }),\n ],\n whileElementsMounted: autoUpdate,\n });\n\n useEffect(() => {\n if (triggerRef.current) {\n refs.setReference(triggerRef.current);\n }\n }, [refs]);\n\n useEffect(() => {\n if (!isOpen) return;\n\n const handleClickOutside = (event: MouseEvent) => {\n const target = event.target as Node;\n if (\n triggerRef.current &&\n !triggerRef.current.contains(target) &&\n refs.floating.current &&\n !refs.floating.current.contains(target)\n ) {\n setIsOpen(false);\n }\n };\n\n const handleEscape = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n setIsOpen(false);\n }\n };\n\n document.addEventListener('mousedown', handleClickOutside);\n document.addEventListener('keydown', handleEscape);\n\n return () => {\n document.removeEventListener('mousedown', handleClickOutside);\n document.removeEventListener('keydown', handleEscape);\n };\n }, [isOpen, refs.floating]);\n\n const handleSelect = (optionValue: T) => {\n onValueChange(optionValue);\n setIsOpen(false);\n };\n\n const handleTriggerClick = (e: React.MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n setIsOpen(!isOpen);\n };\n\n const handleMouseDown = (e: React.MouseEvent) => {\n e.preventDefault();\n };\n\n const defaultRenderOption = (option: SelectOption<T>) => (\n <>\n {option.icon && <span data-element-options-select-icon>{option.icon}</span>}\n {option.color && (\n <span\n data-element-options-select-color\n style={{ backgroundColor: option.color }}\n />\n )}\n <span>{option.label}</span>\n </>\n );\n\n const defaultRenderValue = (option: SelectOption<T> | undefined) => (\n <>\n {option?.icon && <span data-element-options-select-icon>{option.icon}</span>}\n {option?.color && (\n <span\n data-element-options-select-color\n style={{ backgroundColor: option.color }}\n />\n )}\n <span>{option?.label ?? placeholder}</span>\n </>\n );\n\n return (\n <>\n <button\n ref={triggerRef}\n type=\"button\"\n className={className}\n style={style}\n onClick={handleTriggerClick}\n onMouseDown={handleMouseDown}\n data-element-options-select\n data-state={isOpen ? 'open' : 'closed'}\n aria-expanded={isOpen}\n aria-haspopup=\"listbox\">\n <span data-element-options-select-value>\n {renderValue ? renderValue(selectedOption) : defaultRenderValue(selectedOption)}\n </span>\n <ChevronDown data-element-options-select-chevron />\n </button>\n\n {isOpen && (\n <Portal id=\"element-options-select-portal\">\n <div\n ref={refs.setFloating}\n style={floatingStyles}\n data-element-options-select-content\n role=\"listbox\"\n aria-activedescendant={value}\n tabIndex={0}>\n {options.map((option) => (\n <button\n key={String(option.value)}\n type=\"button\"\n role=\"option\"\n aria-selected={option.value === value}\n data-element-options-select-item\n data-selected={option.value === value}\n onClick={() => handleSelect(option.value)}\n onMouseDown={handleMouseDown}>\n <span data-element-options-select-item-content>\n {renderOption ? renderOption(option) : defaultRenderOption(option)}\n </span>\n {option.value === value && (\n <Check data-element-options-select-check />\n )}\n </button>\n ))}\n </div>\n </Portal>\n )}\n </>\n );\n};\n\nElementOptionsSelect.displayName = 'ElementOptions.Select';\n\n","import type { ElementOptionsSeparatorProps } from '../types';\n\nexport const ElementOptionsSeparator = ({\n className,\n style,\n}: ElementOptionsSeparatorProps) => (\n <div\n className={className}\n style={style}\n data-element-options-separator\n role=\"separator\"\n aria-orientation=\"horizontal\"\n />\n);\n\nElementOptionsSeparator.displayName = 'ElementOptions.Separator';\n\n","import type { ElementOptionsSliderProps } from '../types';\n\nexport const ElementOptionsSlider = ({\n value,\n onValueChange,\n min = 0,\n max = 100,\n step = 1,\n className,\n style,\n}: ElementOptionsSliderProps) => {\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n onValueChange(Number(e.target.value));\n };\n\n const handleMouseDown = (e: React.MouseEvent) => {\n e.stopPropagation();\n };\n\n const percentage = ((value - min) / (max - min)) * 100;\n\n return (\n <div\n className={className}\n style={style}\n data-element-options-slider\n onMouseDown={handleMouseDown}>\n <input\n type=\"range\"\n min={min}\n max={max}\n step={step}\n value={value}\n onChange={handleChange}\n data-element-options-slider-input\n style={{\n // CSS variable for styling the track fill\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ['--slider-percentage' as any]: `${percentage}%`,\n }}\n />\n <span data-element-options-slider-value>{value}</span>\n </div>\n );\n};\n\nElementOptionsSlider.displayName = 'ElementOptions.Slider';\n\n","import type { ElementOptionsToggleProps } from '../types';\n\nexport const ElementOptionsToggle = ({\n checked,\n onCheckedChange,\n label,\n className,\n style,\n}: ElementOptionsToggleProps) => {\n const handleClick = (e: React.MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n onCheckedChange(!checked);\n };\n\n const handleMouseDown = (e: React.MouseEvent) => {\n e.preventDefault();\n };\n\n const handleKeyDown = (e: React.KeyboardEvent) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n onCheckedChange(!checked);\n }\n };\n\n return (\n <button\n type=\"button\"\n role=\"switch\"\n aria-checked={checked}\n className={className}\n style={style}\n onClick={handleClick}\n onMouseDown={handleMouseDown}\n onKeyDown={handleKeyDown}\n data-element-options-toggle\n data-state={checked ? 'checked' : 'unchecked'}>\n <span data-element-options-toggle-thumb />\n {label && <span data-element-options-toggle-label>{label}</span>}\n </button>\n );\n};\n\nElementOptionsToggle.displayName = 'ElementOptions.Toggle';\n\n","import { useEffect } from 'react';\nimport {\n type Placement,\n autoUpdate,\n flip,\n offset,\n shift,\n useFloating,\n} from '@floating-ui/react';\nimport { MoreHorizontal } from 'lucide-react';\n\nimport { useElementOptionsContext } from '../context/element-options-context';\nimport type { ElementOptionsTriggerProps } from '../types';\n\nexport const ElementOptionsTrigger = ({\n children,\n className,\n style,\n side,\n align,\n sideOffset = 0,\n alignOffset = 0,\n}: ElementOptionsTriggerProps) => {\n const { isOpen, setIsOpen, triggerRef, anchorRef } = useElementOptionsContext();\n\n // Determine if we should use floating positioning\n const useFloatingPosition = Boolean(anchorRef && side);\n\n // Build placement string for floating-ui\n const placement: Placement = side\n ? align === 'center' || !align\n ? side\n : `${side}-${align}`\n : 'bottom';\n\n const { refs, floatingStyles } = useFloating({\n placement,\n middleware: [\n offset({ mainAxis: sideOffset, crossAxis: alignOffset }),\n flip({ padding: 8 }),\n shift({ padding: 8 }),\n ],\n whileElementsMounted: autoUpdate,\n });\n\n // Sync anchor ref with floating-ui\n useEffect(() => {\n if (anchorRef?.current && useFloatingPosition) {\n refs.setReference(anchorRef.current);\n }\n }, [anchorRef, refs, useFloatingPosition]);\n\n const handleClick = (e: React.MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n setIsOpen(!isOpen);\n };\n\n const handleMouseDown = (e: React.MouseEvent) => {\n e.preventDefault();\n };\n\n // Combine styles: floating styles (if using floating positioning) + custom styles\n const combinedStyles = useFloatingPosition\n ? { ...floatingStyles, ...style }\n : style;\n\n return (\n <button\n ref={(node) => {\n // Set both refs\n (triggerRef as React.MutableRefObject<HTMLButtonElement | null>).current = node;\n if (useFloatingPosition) {\n refs.setFloating(node);\n }\n }}\n type=\"button\"\n className={className}\n style={combinedStyles}\n onClick={handleClick}\n onMouseDown={handleMouseDown}\n data-element-options-trigger\n data-state={isOpen ? 'open' : 'closed'}\n aria-expanded={isOpen}\n aria-haspopup=\"dialog\">\n {children ?? <MoreHorizontal className=\"yoo-element-options-trigger-icon\" />}\n </button>\n );\n};\n\nElementOptionsTrigger.displayName = 'ElementOptions.Trigger';\n","import './element-options.css';\n\nimport { ElementOptionsColorPicker } from './components/element-options-color-picker';\nimport { ElementOptionsContent } from './components/element-options-content';\nimport { ElementOptionsGroup } from './components/element-options-group';\nimport { ElementOptionsInput } from './components/element-options-input';\nimport { ElementOptionsLabel } from './components/element-options-label';\nimport { ElementOptionsRoot } from './components/element-options-root';\nimport { ElementOptionsSelect } from './components/element-options-select';\nimport { ElementOptionsSeparator } from './components/element-options-separator';\nimport { ElementOptionsSlider } from './components/element-options-slider';\nimport { ElementOptionsToggle } from './components/element-options-toggle';\nimport { ElementOptionsTrigger } from './components/element-options-trigger';\n\n// Export types\nexport type {\n Side,\n Align,\n ElementOptionsContextValue,\n ElementOptionsRootProps,\n ElementOptionsTriggerProps,\n ElementOptionsContentProps,\n ElementOptionsGroupProps,\n ElementOptionsLabelProps,\n ElementOptionsSeparatorProps,\n ElementOptionsSelectProps,\n ElementOptionsColorPickerProps,\n ElementOptionsToggleProps,\n ElementOptionsSliderProps,\n ElementOptionsInputProps,\n SelectOption,\n} from './types';\n\n// Export context and hooks\nexport {\n ElementOptionsContext,\n useElementOptionsContext,\n useElementOptions,\n useUpdateElementProps,\n} from './context/element-options-context';\n\n// Export individual components\nexport { ElementOptionsRoot } from './components/element-options-root';\nexport { ElementOptionsTrigger } from './components/element-options-trigger';\nexport { ElementOptionsContent } from './components/element-options-content';\nexport { ElementOptionsGroup } from './components/element-options-group';\nexport { ElementOptionsLabel } from './components/element-options-label';\nexport { ElementOptionsSeparator } from './components/element-options-separator';\nexport { ElementOptionsSelect } from './components/element-options-select';\nexport { ElementOptionsColorPicker } from './components/element-options-color-picker';\nexport { ElementOptionsToggle } from './components/element-options-toggle';\nexport { ElementOptionsSlider } from './components/element-options-slider';\nexport { ElementOptionsInput } from './components/element-options-input';\n\n// Export compound component\nexport const ElementOptions = Object.assign(ElementOptionsRoot, {\n Root: ElementOptionsRoot,\n Trigger: ElementOptionsTrigger,\n Content: ElementOptionsContent,\n Group: ElementOptionsGroup,\n Label: ElementOptionsLabel,\n Separator: ElementOptionsSeparator,\n Select: ElementOptionsSelect,\n ColorPicker: ElementOptionsColorPicker,\n Toggle: ElementOptionsToggle,\n Slider: ElementOptionsSlider,\n Input: ElementOptionsInput,\n});\n"],"names":["_jsxs","_Fragment","_jsx","HexColorPicker","MoreHorizontal"],"mappings":";;;;;;;;;;;;AAaA,MAAM,qBAAqB,GAAG;IAC5B,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;CACV,CAAC;AAEW,MAAA,yBAAyB,GAAG,CAAC,EACxC,KAAK,EACL,QAAQ,EACR,YAAY,GAAG,qBAAqB,EACpC,SAAS,EACT,KAAK,GAC0B,KAAI;IACnC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC5C,IAAA,MAAM,UAAU,GAAG,MAAM,CAAoB,IAAI,CAAC,CAAC;AAEnD,IAAA,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,GAAG,WA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AyB;AACtC,IAAA,MAAM,EAAE,oBAAoB;AAC5B,IAAA,MAAM,EAAE,oBAAoB;AAC5B,IAAA,KAAK,EAAE,mBAAmB;AAC3B,CAAA;;;;","x_google_ignoreList":[7,8,9,10,11,12,13]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"floating-block-actions.js","sources":["../src/floating-block-actions/context.tsx","../src/floating-block-actions/floating-block-actions.tsx"],"sourcesContent":["import { createContext, useContext } from 'react';\nimport type { YooptaBlockData } from '@yoopta/editor';\n\nexport type FloatingBlockActionsContextValue = {\n /** Currently hovered block ID */\n blockId: string | null;\n /** Block data for the hovered block */\n blockData: YooptaBlockData | null;\n /** Whether actions are visible */\n isVisible: boolean;\n /** Hide the floating actions manually */\n hide: () => void;\n};\n\nexport const FloatingBlockActionsContext = createContext<FloatingBlockActionsContextValue | null>(null);\n\nexport const useFloatingBlockActionsContext = () => {\n const context = useContext(FloatingBlockActionsContext);\n\n if (!context) {\n throw new Error('FloatingBlockActions components must be used within <FloatingBlockActions>');\n }\n\n return context;\n};\n","import {\n type CSSProperties,\n type ReactNode,\n forwardRef,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { type YooptaBlockData, useYooptaEditor } from '@yoopta/editor';\n\nimport { FloatingBlockActionsContext } from './context';\nimport { throttle } from '../utils/throttle';\nimport './floating-block-actions.css';\n\ntype FloatingBlockActionsApi = {\n /** Currently hovered block ID */\n blockId: string | null;\n /** Block data for the hovered block */\n blockData: YooptaBlockData | null;\n /** Whether actions are visible */\n isVisible: boolean;\n /** Hide the floating actions manually */\n hide: () => void;\n};\n\ntype FloatingBlockActionsRootProps = {\n children: ReactNode | ((api: FloatingBlockActionsApi) => ReactNode);\n /** When true, hover tracking is paused (e.g., when BlockOptions is open) */\n frozen?: boolean;\n className?: string;\n};\n\ntype FloatingBlockActionsButtonProps = {\n children: ReactNode;\n onClick?: (event: React.MouseEvent) => void;\n className?: string;\n disabled?: boolean;\n title?: string;\n} & React.ButtonHTMLAttributes<HTMLButtonElement>;\n\nconst HIDDEN_STYLES: CSSProperties = {\n position: 'fixed',\n top: 0,\n left: 0,\n opacity: 0,\n pointerEvents: 'none',\n transform: 'scale(0.95)',\n transition: 'transform 150ms ease-out',\n};\n\nconst getVisibleStyles = (top: number, left: number, width: number): CSSProperties => ({\n position: 'fixed',\n top,\n left,\n opacity: 1,\n pointerEvents: 'auto',\n transform: `scale(1) translateX(-${width + 2}px)`,\n transition: 'transform 150ms ease-out',\n});\n\nconst FloatingBlockActionsRoot = ({ children, frozen = false, className = '' }: FloatingBlockActionsRootProps) => {\n const editor = useYooptaEditor();\n const containerRef = useRef<HTMLDivElement>(null);\n\n // Internal state\n const [blockId, setBlockId] = useState<string | null>(null);\n const [styles, setStyles] = useState<CSSProperties>(HIDDEN_STYLES);\n\n // Derived state\n const blockData = blockId ? editor.children[blockId] ?? null : null;\n const isVisible = blockId !== null && styles.opacity === 1;\n\n // Hide actions\n const hide = useCallback(() => {\n setBlockId(null);\n setStyles(HIDDEN_STYLES);\n }, []);\n\n // Update position based on block element\n const updatePosition = useCallback((blockElement: HTMLElement) => {\n const rect = blockElement.getBoundingClientRect();\n const containerWidth = containerRef.current?.offsetWidth ?? 46;\n setStyles(getVisibleStyles(rect.top + 2, rect.left, containerWidth));\n }, []);\n\n // Find closest block to cursor\n const findClosestBlock = useCallback(\n (mouseY: number): { element: HTMLElement; data: YooptaBlockData } | null => {\n if (!editor.refElement) return null;\n\n const blocks = editor.refElement.querySelectorAll<HTMLElement>('[data-yoopta-block]');\n const viewportHeight = window.innerHeight;\n const VIEWPORT_MARGIN = 200;\n const MAX_DISTANCE = 100;\n\n let closestBlock: HTMLElement | null = null;\n let minDistance = Infinity;\n\n for (const blockElement of blocks) {\n const rect = blockElement.getBoundingClientRect();\n\n // Skip blocks outside viewport\n if (rect.bottom < -VIEWPORT_MARGIN || rect.top > viewportHeight + VIEWPORT_MARGIN) {\n continue;\n }\n\n // Cursor is within block bounds\n if (mouseY >= rect.top && mouseY <= rect.bottom) {\n closestBlock = blockElement;\n minDistance = 0;\n break;\n }\n\n // Calculate distance\n const distance = mouseY < rect.top ? rect.top - mouseY : mouseY - rect.bottom;\n if (distance < minDistance) {\n minDistance = distance;\n closestBlock = blockElement;\n }\n }\n\n if (closestBlock && minDistance <= MAX_DISTANCE) {\n const foundBlockId = closestBlock.getAttribute('data-yoopta-block-id');\n const foundBlockData = foundBlockId ? editor.children[foundBlockId] : null;\n\n if (foundBlockId && foundBlockData) {\n return { element: closestBlock, data: foundBlockData };\n }\n }\n\n return null;\n },\n [editor],\n );\n\n // Mouse move handler\n const handleMouseMove = useCallback(\n (event: MouseEvent) => {\n // If frozen, ignore mouse movement\n if (frozen) return;\n\n const target = event.target as HTMLElement;\n const isInsideEditor = editor.refElement?.contains(target);\n const isInsideActions = containerRef.current?.contains(target);\n\n // Outside editor - hide\n if (!isInsideEditor) {\n hide();\n return;\n }\n\n // Read-only mode - ignore\n if (editor.readOnly) return;\n\n // Inside floating actions - keep current state\n if (isInsideActions) return;\n\n const closestBlock = findClosestBlock(event.clientY);\n\n if (closestBlock) {\n const { element, data } = closestBlock;\n // Only update if different block\n if (data.id !== blockId) {\n setBlockId(data.id);\n updatePosition(element);\n }\n } else if (blockId !== null) {\n hide();\n }\n },\n [frozen, editor, blockId, findClosestBlock, updatePosition, hide],\n );\n\n // Throttled mouse move\n const throttledMouseMove = useMemo(\n () => throttle(handleMouseMove, 100, { leading: true, trailing: true }),\n [handleMouseMove],\n );\n\n // Set up event listeners\n useEffect(() => {\n const handleScroll = () => {\n if (frozen) return;\n hide();\n };\n\n document.addEventListener('mousemove', throttledMouseMove);\n document.addEventListener('scroll', handleScroll, true);\n\n return () => {\n document.removeEventListener('mousemove', throttledMouseMove);\n document.removeEventListener('scroll', handleScroll, true);\n };\n }, [throttledMouseMove, hide, frozen]);\n\n // Context value\n const contextValue = useMemo<FloatingBlockActionsApi>(\n () => ({\n blockId,\n blockData,\n isVisible,\n hide,\n }),\n [blockId, blockData, isVisible, hide],\n );\n\n // Render props or regular children\n const content = typeof children === 'function' ? children(contextValue) : children;\n\n return (\n <FloatingBlockActionsContext.Provider value={contextValue}>\n <div\n ref={containerRef}\n className={`yoopta-ui-floating-block-actions ${className}`}\n style={styles}\n contentEditable={false}\n onClick={(e) => e.stopPropagation()}\n onMouseDown={(e) => e.stopPropagation()}\n >\n {content}\n </div>\n </FloatingBlockActionsContext.Provider>\n );\n};\n\nFloatingBlockActionsRoot.displayName = 'FloatingBlockActions';\n\nconst FloatingBlockActionsButton = forwardRef<HTMLButtonElement, FloatingBlockActionsButtonProps>(\n ({ children, onClick, className = '', disabled, title, ...props }, ref) => (\n <button\n ref={ref}\n type=\"button\"\n className={`yoopta-ui-floating-action-button ${className}`}\n onClick={onClick}\n disabled={disabled}\n title={title}\n aria-label={title}\n {...props}\n >\n {children}\n </button>\n ),\n);\n\nFloatingBlockActionsButton.displayName = 'FloatingBlockActions.Button';\n\nexport const FloatingBlockActions = Object.assign(FloatingBlockActionsRoot, {\n Root: FloatingBlockActionsRoot,\n Button: FloatingBlockActionsButton,\n});\n\nexport type { FloatingBlockActionsRootProps, FloatingBlockActionsButtonProps, FloatingBlockActionsApi };"],"names":["_jsx"],"mappings":";;;;;;;AAcO,MAAM,2BAA2B,GAAG,aAAa,CAA0C,IAAI,CAAC,CAAC;AAEjG,MAAM,8BAA8B,GAAG,MAAK;AACjD,IAAA,MAAM,OAAO,GAAG,UAAU,CAAC,2BAA2B,CAAC,CAAC;IAExD,IAAI,CAAC,OAAO,EAAE;AACZ,QAAA,MAAM,IAAI,KAAK,CAAC,4EAA4E,CAAC,CAAC;AAC/F,KAAA;AAED,IAAA,OAAO,OAAO,CAAC;AACjB;;;;;ACkBA,MAAM,aAAa,GAAkB;AACnC,IAAA,QAAQ,EAAE,OAAO;AACjB,IAAA,GAAG,EAAE,CAAC;AACN,IAAA,IAAI,EAAE,CAAC;AACP,IAAA,OAAO,EAAE,CAAC;AACV,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AO,EAAE,SAAS,GAAG,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAY,GAAA,EAAA,EAAP,KAAK,GAAA,MAAA,CAAA,EAAA,EAA9D,yDAAgE,CAAF,CAAA;AAAY,IAAA,QACzEA,GAAA,CAAA,QAAA,EAAA,MAAA,CAAA,MAAA,CAAA,EACE,GAAG,EAAE,GAAG,EACR,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,CAAoC,iCAAA,EAAA,SAAS,EAAE,EAC1D,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,KAAK,EACA,YAAA,EAAA,KAAK,IACb,KAAK,EAAA,EAAA,QAAA,EAER,QAAQ,EAAA,CAAA,CACF,EACV;AAAA,CAAA,CACF,CAAC;AAEF,0BAA0B,CAAC,WAAW,GAAG,6BAA6B,CAAC;MAE1D,oBAAoB,GAAG,MAAM,CAAC,MAAM,CAAC,wBAAwB,EAAE;AAC1E,IAAA,IAAI,EAAE,wBAAwB;AAC9B,IAAA,MAAM,EAAE,0BAA0B;AACnC,CAAA;;;;"}
|
|
@@ -28,10 +28,10 @@ export declare const FloatingToolbar: {
|
|
|
28
28
|
({ children, frozen, className }: FloatingToolbarRootProps): import("react/jsx-runtime").JSX.Element;
|
|
29
29
|
displayName: string;
|
|
30
30
|
};
|
|
31
|
-
Content:
|
|
32
|
-
children:
|
|
33
|
-
|
|
34
|
-
}
|
|
31
|
+
Content: {
|
|
32
|
+
({ children, className, ...props }: FloatingToolbarContentProps): import("react/jsx-runtime").JSX.Element | null;
|
|
33
|
+
displayName: string;
|
|
34
|
+
};
|
|
35
35
|
Group: import("react").ForwardRefExoticComponent<FloatingToolbarGroupProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
36
36
|
Separator: import("react").ForwardRefExoticComponent<FloatingToolbarSeparatorProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
37
37
|
Button: import("react").ForwardRefExoticComponent<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"floating-toolbar.d.ts","sourceRoot":"","sources":["../../src/floating-toolbar/floating-toolbar.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"floating-toolbar.d.ts","sourceRoot":"","sources":["../../src/floating-toolbar/floating-toolbar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,SAAS,EAOf,MAAM,OAAO,CAAC;AAef,OAAO,wBAAwB,CAAC;AAEhC,KAAK,kBAAkB,GAAG;IACxB,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,KAAK,wBAAwB,GAAG;IAC9B,QAAQ,EAAE,SAAS,GAAG,CAAC,CAAC,GAAG,EAAE,kBAAkB,KAAK,SAAS,CAAC,CAAC;IAC/D,6EAA6E;IAC7E,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAsMF,KAAK,2BAA2B,GAAG;IACjC,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AA0BnC,KAAK,yBAAyB,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAYhE,KAAK,6BAA6B,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAUpE,KAAK,0BAA0B,GAAG;IAChC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;CACtC,GAAG,cAAc,CAAC,iBAAiB,CAAC,CAAC;AAmBtC,eAAO,MAAM,eAAe;sCA9Q+C,wBAAwB;;;;0CAAxB,wBAAwB;;;;4CAyM3B,2BAA2B;;;;;;;;;;CA2EjG,CAAC;AAEH,YAAY,EACV,wBAAwB,EACxB,2BAA2B,EAC3B,yBAAyB,EACzB,6BAA6B,EAC7B,0BAA0B,EAC1B,kBAAkB,GACnB,CAAC"}
|
package/dist/floating-toolbar.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as o}from"./chunks/_tslib-5e145dfd.js";import{jsx as t}from"react/jsx-runtime";import{createContext as a,useContext as i,forwardRef as e,useState as
|
|
1
|
+
import{_ as o}from"./chunks/_tslib-5e145dfd.js";import{jsx as t}from"react/jsx-runtime";import{createContext as a,useContext as i,forwardRef as e,useState as n,useRef as r,useMemo as l,useCallback as s,useEffect as p}from"react";import{u,i as c,f as g,s as d,o as b,a as f,c as y,F as m}from"./chunks/floating-ui.react-b048728e.js";import{useYooptaEditor as h}from"@yoopta/editor";import{t as v}from"./chunks/throttle-dea4a39e.js";import{s as x}from"./chunks/style-inject.es-e87a8d02.js";import"react-dom";const w=a(null),k=()=>{const o=i(w);if(!o)throw new Error("FloatingToolbar components must be used within <FloatingToolbar>");return o};x(":root{--yoopta-ui-background:0 0% 100%;--yoopta-ui-foreground:222.2 84% 4.9%;--yoopta-ui-border:214.3 31.8% 91.4%;--yoopta-ui-accent:210 40% 96.1%;--yoopta-ui-ring:222.2 84% 4.9%;--yoopta-ui-primary:221.2 83.2% 53.3%;--yoopta-ui-primary-foreground:210 40% 98%;--yoopta-ui-floating-toolbar-gap:4px;--yoopta-ui-floating-toolbar-padding:6px;--yoopta-ui-floating-toolbar-radius:0.5rem;--yoopta-ui-floating-toolbar-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--yoopta-ui-floating-toolbar-z-index:99;--yoopta-ui-floating-toolbar-group-gap:2px;--yoopta-ui-floating-toolbar-separator-height:24px;--yoopta-ui-floating-toolbar-separator-margin:4px;--yoopta-ui-floating-toolbar-button-min-width:32px;--yoopta-ui-floating-toolbar-button-min-height:32px;--yoopta-ui-floating-toolbar-button-padding-y:6px;--yoopta-ui-floating-toolbar-button-padding-x:8px;--yoopta-ui-floating-toolbar-button-font-size:0.875rem;--yoopta-ui-floating-toolbar-button-font-weight:500;--yoopta-ui-floating-toolbar-button-gap:4px;--yoopta-ui-floating-toolbar-button-radius:0.375rem;--yoopta-ui-floating-toolbar-icon-size:1rem;--yoopta-ui-floating-toolbar-ring-offset:2px}.dark,[data-theme=dark]{--yoopta-ui-background:222.2 84% 4.9%;--yoopta-ui-foreground:210 40% 98%;--yoopta-ui-border:217.2 32.6% 17.5%;--yoopta-ui-accent:217.2 32.6% 17.5%;--yoopta-ui-ring:212.7 26.8% 83.9%}.yoopta-ui-floating-toolbar{align-items:center;background:hsl(var(--yoopta-ui-background));border:1px solid hsl(var(--yoopta-ui-border));border-radius:var(--yoopta-ui-floating-toolbar-radius,.5rem);box-shadow:var(--yoopta-ui-floating-toolbar-shadow,0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1));display:flex;gap:var(--yoopta-ui-floating-toolbar-gap,4px);padding:var(--yoopta-ui-floating-toolbar-padding,6px);-webkit-user-select:none;-moz-user-select:none;user-select:none;z-index:var(--yoopta-ui-floating-toolbar-z-index,99)}.yoopta-ui-floating-toolbar-group{align-items:center;display:flex;gap:var(--yoopta-ui-floating-toolbar-group-gap,2px)}.yoopta-ui-floating-toolbar-separator{background:hsl(var(--yoopta-ui-border));height:var(--yoopta-ui-floating-toolbar-separator-height,24px);margin:0 var(--yoopta-ui-floating-toolbar-separator-margin,4px);width:1px}.yoopta-ui-floating-toolbar-button{align-items:center;background:transparent;border:none;border-radius:var(--yoopta-ui-floating-toolbar-button-radius,.375rem);color:hsl(var(--yoopta-ui-foreground));cursor:pointer;display:inline-flex;font-size:var(--yoopta-ui-floating-toolbar-button-font-size,.875rem);font-weight:var(--yoopta-ui-floating-toolbar-button-font-weight,500);gap:var(--yoopta-ui-floating-toolbar-button-gap,4px);justify-content:center;min-height:var(--yoopta-ui-floating-toolbar-button-min-height,32px);min-width:var(--yoopta-ui-floating-toolbar-button-min-width,32px);outline:none;padding:var(--yoopta-ui-floating-toolbar-button-padding-y,6px) var(--yoopta-ui-floating-toolbar-button-padding-x,8px);transition:all .15s cubic-bezier(.4,0,.2,1);white-space:nowrap}.yoopta-ui-floating-toolbar-button:hover:not(:disabled){background:hsl(var(--yoopta-ui-accent))}.yoopta-ui-floating-toolbar-button:focus-visible{outline:2px solid hsl(var(--yoopta-ui-ring));outline-offset:var(--yoopta-ui-floating-toolbar-ring-offset,2px)}.yoopta-ui-floating-toolbar-button[data-active=true]{background:hsl(var(--yoopta-ui-primary,221.2 83.2% 53.3%));color:hsl(var(--yoopta-ui-primary-foreground,210 40% 98%))}.yoopta-ui-floating-toolbar-button:disabled{cursor:not-allowed;opacity:.5}.yoopta-ui-floating-toolbar-button svg{height:var(--yoopta-ui-floating-toolbar-icon-size,1rem);width:var(--yoopta-ui-floating-toolbar-icon-size,1rem)}");const N=({children:o,frozen:a=!1,className:i=""})=>{const e=h(),[m,x]=n(!1),k=r(null),{refs:N,floatingStyles:j,context:O}=u({placement:"top-start",open:m,middleware:[c(),g(),d(),b(10)],whileElementsMounted:f}),{isMounted:F,styles:R}=y(O,{duration:100});console.log("FloatingToolbarRoot refs",N),console.log("FloatingToolbarRoot open state",{isOpen:m,isMounted:F});const z=l(()=>Object.assign(Object.assign({},j),R),[j,R]),C=r(N.setReference);C.current=N.setReference;const E=s(()=>{x(!1)},[]),T=s(()=>{x(!0)},[]),A=s(()=>{var o,t;if(a)return;const i=k.current;if(null==i?void 0:i.contains(document.activeElement))return;const n=window.getSelection();if(!n||(null==n?void 0:n.isCollapsed)||(null==n?void 0:n.anchorOffset)===(null==n?void 0:n.focusOffset))return void(m&&E());const r=n.getRangeAt(0),l=r.getBoundingClientRect(),s=r.toString().trim(),p=null==r?void 0:r.commonAncestorContainer,u=!!(null===(o=null==p?void 0:p.closest)||void 0===o?void 0:o.call(p,"[data-custom-editor]"));if((null===(t=e.refElement)||void 0===t?void 0:t.contains(p))&&!u){if(r&&s.length>0){const o={getBoundingClientRect:()=>l,getClientRects:()=>r.getClientRects()};C.current(o),m||T()}}else m&&E()},[a,e.refElement,E,T,m]),M=s(()=>{var o;if(!Array.isArray(e.path.selected)||0===e.path.selected.length||"mousemove"!==e.path.source&&"keyboard"!==e.path.source)return void(m&&E());const t=Math.min(...e.path.selected),a=Math.max(...e.path.selected);let i=!0;"number"==typeof e.path.current&&(i=Math.abs(e.path.current-a)<=Math.abs(e.path.current-t));const n=e.getBlock({at:i?a:t});if(!n)return;const r=null===(o=e.refElement)||void 0===o?void 0:o.querySelector(`[data-yoopta-block-id="${n.id}"]`);r&&(C.current(r),m||T())},[e,E,T,m]),S=l(()=>v(A,200,{leading:!0,trailing:!0}),[A]);p(()=>{if(Array.isArray(e.path.selected)||e.path.selection){if(!Array.isArray(e.path.selected)||e.path.selection)return window.document.addEventListener("selectionchange",S),()=>window.document.removeEventListener("selectionchange",S);M()}else m&&E()},[e.path.selected,e.path.selection,m,S,E,M]);const $=s(o=>{k.current=o,N.setFloating(o)},[N.setFloating,N.setReference]),B=l(()=>({isOpen:F,floatingStyles:z,setFloatingRef:$}),[F,z,$]),P="function"==typeof o?o({isOpen:F}):o;return t(w.Provider,Object.assign({value:B},{children:t("div",Object.assign({className:i},{children:P}))}))};N.displayName="FloatingToolbar";const j=a=>{var{children:i,className:e=""}=a,n=o(a,["children","className"]);const r=h(),{isOpen:l,floatingStyles:s,setFloatingRef:p}=k();return l?t(m,Object.assign({root:r.refElement,id:`yoopta-ui-floating-toolbar-portal-${r.id}`},{children:t("div",Object.assign({ref:p,className:`yoopta-ui-floating-toolbar ${e}`,style:s,onClick:o=>o.stopPropagation(),onMouseDown:o=>o.stopPropagation()},n,{children:i}))})):null};j.displayName="FloatingToolbar.Content";const O=e((a,i)=>{var{className:e="",children:n}=a,r=o(a,["className","children"]);return t("div",Object.assign({ref:i,className:`yoopta-ui-floating-toolbar-group ${e}`},r,{children:n}))});O.displayName="FloatingToolbar.Group";const F=e((a,i)=>{var{className:e=""}=a,n=o(a,["className"]);return t("div",Object.assign({ref:i,className:`yoopta-ui-floating-toolbar-separator ${e}`},n))});F.displayName="FloatingToolbar.Separator";const R=e((a,i)=>{var{className:e="",children:n,active:r,disabled:l,type:s="button"}=a,p=o(a,["className","children","active","disabled","type"]);return t("button",Object.assign({ref:i,type:s,disabled:l,"data-active":r,className:`yoopta-ui-floating-toolbar-button ${e}`},p,{children:n}))});R.displayName="FloatingToolbar.Button";const z=Object.assign(N,{Root:N,Content:j,Group:O,Separator:F,Button:R});export{z as FloatingToolbar,k as useFloatingToolbarContext};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"floating-toolbar.js","sources":["../src/floating-toolbar/context.tsx","../src/floating-toolbar/floating-toolbar.tsx"],"sourcesContent":["import { createContext, useContext } from 'react';\nimport type { CSSProperties } from 'react';\n\nexport type FloatingToolbarContextValue = {\n /** Whether toolbar is open/visible */\n isOpen: boolean;\n /** Floating UI styles for positioning */\n floatingStyles: CSSProperties;\n /** Ref setter for the floating element */\n setFloatingRef: (node: HTMLElement | null) => void;\n};\n\nexport const FloatingToolbarContext = createContext<FloatingToolbarContextValue | null>(null);\n\nexport const useFloatingToolbarContext = () => {\n const context = useContext(FloatingToolbarContext);\n\n if (!context) {\n throw new Error('FloatingToolbar components must be used within <FloatingToolbar>');\n }\n\n return context;\n};\n","import {\n type CSSProperties,\n type HTMLAttributes,\n type ReactNode,\n forwardRef,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport {\n FloatingPortal,\n autoUpdate,\n flip,\n inline,\n offset,\n shift,\n useFloating,\n useTransitionStyles,\n} from '@floating-ui/react';\nimport { useYooptaEditor } from '@yoopta/editor';\n\nimport { FloatingToolbarContext, useFloatingToolbarContext } from './context';\nimport { throttle } from '../utils/throttle';\nimport './floating-toolbar.css';\n\ntype FloatingToolbarApi = {\n isOpen: boolean;\n};\n\ntype FloatingToolbarRootProps = {\n children: ReactNode | ((api: FloatingToolbarApi) => ReactNode);\n /** When true, selection tracking is paused (e.g., when a popover is open) */\n frozen?: boolean;\n className?: string;\n};\n\nconst FloatingToolbarRoot = ({ children, frozen = false, className = '' }: FloatingToolbarRootProps) => {\n const editor = useYooptaEditor();\n const [isOpen, setIsOpen] = useState(false);\n\n // Local ref to track floating element for checking if active element is inside\n const floatingElRef = useRef<HTMLElement | null>(null);\n\n // Floating UI setup with autoUpdate for proper positioning\n const { refs, floatingStyles, context } = useFloating({\n placement: 'top-start',\n open: isOpen,\n middleware: [inline(), flip(), shift(), offset(10)],\n whileElementsMounted: autoUpdate,\n });\n\n const { isMounted, styles: transitionStyles } = useTransitionStyles(context, {\n duration: 100,\n });\n\n console.log('FloatingToolbarRoot refs', refs);\n console.log('FloatingToolbarRoot open state', { isOpen, isMounted });\n\n // Combined styles\n const combinedStyles: CSSProperties = useMemo(\n () => ({ ...floatingStyles, ...transitionStyles }),\n [floatingStyles, transitionStyles],\n );\n\n // Keep setReference in a ref for stable callback\n const setReferenceFnRef = useRef(refs.setReference);\n setReferenceFnRef.current = refs.setReference;\n\n // Close toolbar\n const close = useCallback(() => {\n setIsOpen(false);\n }, []);\n\n // Open toolbar\n const open = useCallback(() => {\n setIsOpen(true);\n }, []);\n\n // Text selection change handler\n const selectionChange = useCallback(() => {\n if (frozen) return;\n\n // Check if active element is inside the toolbar\n const toolbarEl = floatingElRef.current;\n if (toolbarEl?.contains(document.activeElement)) {\n return;\n }\n\n const domSelection = window.getSelection();\n\n if (\n !domSelection ||\n domSelection?.isCollapsed ||\n domSelection?.anchorOffset === domSelection?.focusOffset\n ) {\n if (isOpen) {\n close();\n }\n return;\n }\n\n const domRange = domSelection.getRangeAt(0);\n const selectionRect = domRange.getBoundingClientRect();\n const text = domRange.toString().trim();\n\n const ancestor = domRange?.commonAncestorContainer;\n\n // Check if inside custom editor\n const isInsideCustomEditor = !!(ancestor as Element)?.closest?.('[data-custom-editor]');\n\n if (!editor.refElement?.contains(ancestor) || isInsideCustomEditor) {\n if (isOpen) {\n close();\n }\n return;\n }\n\n if (domRange && text.length > 0) {\n const reference = {\n getBoundingClientRect: () => selectionRect,\n getClientRects: () => domRange.getClientRects(),\n };\n\n setReferenceFnRef.current(reference);\n\n if (!isOpen) {\n open();\n }\n }\n }, [frozen, editor.refElement, close, open, isOpen]);\n\n // Block selection change handler\n const onBlockSelectionChange = useCallback(() => {\n if (\n !Array.isArray(editor.path.selected) ||\n editor.path.selected.length === 0 ||\n (editor.path.source !== 'mousemove' && editor.path.source !== 'keyboard')\n ) {\n if (isOpen) {\n close();\n }\n return;\n }\n\n const firstSelectedBlockPath = Math.min(...editor.path.selected);\n const lastSelectedBlockPath = Math.max(...editor.path.selected);\n\n let isBottomDirection = true;\n\n if (typeof editor.path.current === 'number') {\n isBottomDirection =\n Math.abs(editor.path.current - lastSelectedBlockPath) <=\n Math.abs(editor.path.current - firstSelectedBlockPath);\n }\n\n const selectedBlock = editor.getBlock({\n at: isBottomDirection ? lastSelectedBlockPath : firstSelectedBlockPath,\n });\n\n if (!selectedBlock) return;\n\n const blockEl = editor.refElement?.querySelector(`[data-yoopta-block-id=\"${selectedBlock.id}\"]`);\n\n if (!blockEl) return;\n\n setReferenceFnRef.current(blockEl);\n\n if (!isOpen) {\n open();\n }\n }, [editor, close, open, isOpen]);\n\n // Throttled selection change\n const throttledSelectionChange = useMemo(\n () =>\n throttle(selectionChange, 200, {\n leading: true,\n trailing: true,\n }),\n [selectionChange],\n );\n\n // Selection tracking effect\n useEffect(() => {\n if (!Array.isArray(editor.path.selected) && !editor.path.selection) {\n if (isOpen) {\n close();\n }\n return;\n }\n\n if (Array.isArray(editor.path.selected) && !editor.path.selection) {\n onBlockSelectionChange();\n return;\n }\n\n window.document.addEventListener('selectionchange', throttledSelectionChange);\n return () => window.document.removeEventListener('selectionchange', throttledSelectionChange);\n }, [editor.path.selected, editor.path.selection, isOpen, throttledSelectionChange, close, onBlockSelectionChange]);\n\n // Ref callback that updates both local ref and floating ref\n const handleFloatingRef = useCallback(\n (node: HTMLElement | null) => {\n floatingElRef.current = node;\n refs.setFloating(node);\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [refs.setFloating, refs.setReference],\n );\n\n // Context value - use isMounted for visibility\n const contextValue = useMemo(\n () => ({\n isOpen: isMounted,\n floatingStyles: combinedStyles,\n setFloatingRef: handleFloatingRef,\n }),\n [isMounted, combinedStyles, handleFloatingRef],\n );\n\n // Render props or regular children\n const content = typeof children === 'function' ? children({ isOpen: isMounted }) : children;\n\n return (\n <FloatingToolbarContext.Provider value={contextValue}>\n <div className={className}>{content}</div>\n </FloatingToolbarContext.Provider>\n );\n};\n\nFloatingToolbarRoot.displayName = 'FloatingToolbar';\n\ntype FloatingToolbarContentProps = {\n children: ReactNode;\n className?: string;\n} & HTMLAttributes<HTMLDivElement>;\n\nconst FloatingToolbarContent = ({ children, className = '', ...props }: FloatingToolbarContentProps) => {\n const editor = useYooptaEditor();\n const { isOpen, floatingStyles, setFloatingRef } = useFloatingToolbarContext();\n\n if (!isOpen) return null;\n\n return (\n <FloatingPortal root={editor.refElement} id={`yoopta-ui-floating-toolbar-portal-${editor.id}`}>\n <div\n ref={setFloatingRef}\n className={`yoopta-ui-floating-toolbar ${className}`}\n style={floatingStyles}\n onClick={(e) => e.stopPropagation()}\n onMouseDown={(e) => e.stopPropagation()}\n {...props}\n >\n {children}\n </div>\n </FloatingPortal>\n );\n};\n\nFloatingToolbarContent.displayName = 'FloatingToolbar.Content';\n\ntype FloatingToolbarGroupProps = HTMLAttributes<HTMLDivElement>;\n\nconst FloatingToolbarGroup = forwardRef<HTMLDivElement, FloatingToolbarGroupProps>(\n ({ className = '', children, ...props }, ref) => (\n <div ref={ref} className={`yoopta-ui-floating-toolbar-group ${className}`} {...props}>\n {children}\n </div>\n ),\n);\n\nFloatingToolbarGroup.displayName = 'FloatingToolbar.Group';\n\ntype FloatingToolbarSeparatorProps = HTMLAttributes<HTMLDivElement>;\n\nconst FloatingToolbarSeparator = forwardRef<HTMLDivElement, FloatingToolbarSeparatorProps>(\n ({ className = '', ...props }, ref) => (\n <div ref={ref} className={`yoopta-ui-floating-toolbar-separator ${className}`} {...props} />\n ),\n);\n\nFloatingToolbarSeparator.displayName = 'FloatingToolbar.Separator';\n\ntype FloatingToolbarButtonProps = {\n active?: boolean;\n disabled?: boolean;\n type?: 'button' | 'submit' | 'reset';\n} & HTMLAttributes<HTMLButtonElement>;\n\nconst FloatingToolbarButton = forwardRef<HTMLButtonElement, FloatingToolbarButtonProps>(\n ({ className = '', children, active, disabled, type = 'button', ...props }, ref) => (\n <button\n ref={ref}\n type={type}\n disabled={disabled}\n data-active={active}\n className={`yoopta-ui-floating-toolbar-button ${className}`}\n {...props}\n >\n {children}\n </button>\n ),\n);\n\nFloatingToolbarButton.displayName = 'FloatingToolbar.Button';\n\nexport const FloatingToolbar = Object.assign(FloatingToolbarRoot, {\n Root: FloatingToolbarRoot,\n Content: FloatingToolbarContent,\n Group: FloatingToolbarGroup,\n Separator: FloatingToolbarSeparator,\n Button: FloatingToolbarButton,\n});\n\nexport type {\n FloatingToolbarRootProps,\n FloatingToolbarContentProps,\n FloatingToolbarGroupProps,\n FloatingToolbarSeparatorProps,\n FloatingToolbarButtonProps,\n FloatingToolbarApi,\n};\n"],"names":["_jsx"],"mappings":";;;;;;;;;AAYO,MAAM,sBAAsB,GAAG,aAAa,CAAqC,IAAI,CAAC,CAAC;AAEvF,MAAM,yBAAyB,GAAG,MAAK;AAC5C,IAAA,MAAM,OAAO,GAAG,UAAU,CAAC,sBAAsB,CAAC,CAAC;IAEnD,IAAI,CAAC,OAAO,EAAE;AACZ,QAAA,MAAM,IAAI,KAAK,CAAC,kEAAkE,CAAC,CAAC;AACrF,KAAA;AAED,IAAA,OAAO,OAAO,CAAC;AACjB;;;;;ACgBA,MAAM,mBAAmB,GAAG,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,KAAK,EAAE,SAAS,GAAG,EAAE,EAA4B,KAAI;AACrG,IAAA,MAAM,MAAM,GAAG,eAAe,EAAE,CAAC;IACjC,MAAM,CAAC,MAAM,EAAE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,CAAA,CAAI,EAC7F;AAAA,CAAA,CACF,CAAC;AAEF,wBAAwB,CAAC,WAAW,GAAG,2BAA2B,CAAC;AAQnE,MAAM,qBAAqB,GAAG,UAAU,CACtC,CAAC,EAAyE,EAAE,GAAG,KAAI;AAAlF,IAAA,IAAA,EAAE,SAAS,GAAG,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,GAAG,QAAQ,EAAA,GAAA,EAAY,EAAP,KAAK,GAAA,MAAA,CAAA,EAAA,EAAvE,uDAAyE,CAAF,CAAA;IAAY,QAClFA,GACE,CAAA,QAAA,EAAA,MAAA,CAAA,MAAA,CAAA,EAAA,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,QAAQ,EACL,aAAA,EAAA,MAAM,EACnB,SAAS,EAAE,CAAA,kCAAA,EAAqC,SAAS,CAAA,CAAE,EACvD,EAAA,KAAK,EAER,EAAA,QAAA,EAAA,QAAQ,EACF,CAAA,CAAA,EACV;AAAA,CAAA,CACF,CAAC;AAEF,qBAAqB,CAAC,WAAW,GAAG,wBAAwB,CAAC;MAEhD,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,mBAAmB,EAAE;AAChE,IAAA,IAAI,EAAE,mBAAmB;AACzB,IAAA,OAAO,EAAE,sBAAsB;AAC/B,IAAA,KAAK,EAAE,oBAAoB;AAC3B,IAAA,SAAS,EAAE,wBAAwB;AACnC,IAAA,MAAM,EAAE,qBAAqB;AAC9B,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as r}from"./chunks/style-inject.es-e87a8d02.js";export{H as HighlightColorPicker}from"./chunks/highlight-color-picker-
|
|
1
|
+
import{s as r}from"./chunks/style-inject.es-e87a8d02.js";export{H as HighlightColorPicker}from"./chunks/highlight-color-picker-a1a292a9.js";import"react/jsx-runtime";import"react";import"./chunks/floating-ui.react-b048728e.js";import"react-dom";import"./chunks/index-e0185864.js";r(".yoopta-highlight-color-picker{--hcp-bg:#fff;--hcp-fg:#18181b;--hcp-muted:#71717a;--hcp-border:#e4e4e7;--hcp-ring:#3b82f6;--hcp-shadow:0 16px 48px -12px rgba(0,0,0,.18),0 4px 16px -4px rgba(0,0,0,.1);--hcp-radius:10px;--hcp-pad:10px;--hcp-gap:10px;--hcp-width:224px;--hcp-picker-height:120px;--hcp-preset-size:24px;--hcp-input-height:26px;background:var(--hcp-bg);border:1px solid var(--hcp-border);border-radius:var(--hcp-radius);box-shadow:var(--hcp-shadow);color:var(--hcp-fg);display:flex;flex-direction:column;gap:8px;outline:none;padding:var(--hcp-pad);-webkit-user-select:none;-moz-user-select:none;user-select:none;width:var(--hcp-width);z-index:9999}.dark .yoopta-highlight-color-picker,.yoopta-highlight-color-picker[data-theme=dark]{--hcp-bg:#18181b;--hcp-fg:#fafafa;--hcp-muted:#a1a1aa;--hcp-border:#3f3f46;--hcp-shadow:0 16px 48px -12px rgba(0,0,0,.5),0 4px 16px -4px rgba(0,0,0,.3)}.yoopta-highlight-color-picker__mode-toggle{background:var(--hcp-border);border-radius:8px;display:flex;flex-shrink:0;gap:4px;padding:4px}.yoopta-highlight-color-picker__mode-btn{background:transparent;border:none;border-radius:6px;color:var(--hcp-muted);cursor:pointer;flex:1;font-size:11px;font-weight:500;line-height:1.4;outline:none;padding:4px 8px;text-align:center;transition:background-color .12s ease,color .12s ease}.yoopta-highlight-color-picker__mode-btn:hover{color:var(--hcp-fg)}.yoopta-highlight-color-picker__mode-btn[data-active=true]{background:var(--hcp-bg);box-shadow:0 1px 2px rgba(0,0,0,.1);color:var(--hcp-fg)}.yoopta-highlight-color-picker__mode-btn:focus-visible{outline:2px solid var(--hcp-ring);outline-offset:2px}.yoopta-highlight-color-picker__react-colorful{height:var(--hcp-picker-height)!important;width:100%!important}.yoopta-highlight-color-picker__react-colorful .react-colorful__saturation{border:1px solid var(--hcp-border);border-radius:8px}.yoopta-highlight-color-picker__react-colorful .react-colorful__hue{border:1px solid var(--hcp-border);border-radius:999px;height:10px;margin-top:8px}.yoopta-highlight-color-picker__react-colorful .react-colorful__pointer{border:2px solid var(--hcp-bg);border-radius:999px;box-shadow:0 2px 6px rgba(0,0,0,.22);height:16px;width:16px}.yoopta-highlight-color-picker__presets{align-items:center;display:flex;flex-direction:row;flex-wrap:nowrap;gap:6px;overflow-x:auto;padding-bottom:2px;scrollbar-color:var(--hcp-border) transparent;scrollbar-width:thin}.yoopta-highlight-color-picker__presets::-webkit-scrollbar{height:6px}.yoopta-highlight-color-picker__presets::-webkit-scrollbar-track{background:transparent}.yoopta-highlight-color-picker__presets::-webkit-scrollbar-thumb{background-color:var(--hcp-border);border-radius:999px}.yoopta-highlight-color-picker__preset{border:2px solid var(--hcp-border);border-radius:7px;cursor:pointer;flex:0 0 auto;height:var(--hcp-preset-size);outline:none;padding:0;transition:transform .12s ease,border-color .12s ease,box-shadow .12s ease;width:var(--hcp-preset-size)}.yoopta-highlight-color-picker__preset:hover{transform:scale(1.08)}.yoopta-highlight-color-picker__preset:focus-visible{border-color:var(--hcp-ring);box-shadow:0 0 0 2px var(--hcp-ring)}.yoopta-highlight-color-picker__preset[data-selected=true]{border-color:var(--hcp-ring);box-shadow:0 0 0 2px rgba(59,130,246,.35)}.yoopta-highlight-color-picker__hex-row{align-items:center;display:flex;gap:8px}.yoopta-highlight-color-picker__swatch{border:1px solid var(--hcp-border);border-radius:7px;flex:0 0 auto;height:var(--hcp-input-height);width:var(--hcp-input-height)}.yoopta-highlight-color-picker__hex-input{background:transparent;border:1px solid var(--hcp-border);border-radius:9px;color:var(--hcp-fg);flex:1;font-size:12px;height:var(--hcp-input-height);line-height:1;min-width:0;outline:none;padding:0 10px}.yoopta-highlight-color-picker__hex-input:focus{border-color:var(--hcp-ring);box-shadow:0 0 0 2px rgba(59,130,246,.25)}.yoopta-highlight-color-picker__hex-input::-moz-placeholder{color:var(--hcp-muted)}.yoopta-highlight-color-picker__hex-input::placeholder{color:var(--hcp-muted)}");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"highlight-color-picker.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{SlashCommandMenu}from"./slash-command-menu.js";export{ElementOptions,useElementOptions,useElementOptionsContext,useUpdateElementProps}from"./element-options.js";export{FloatingBlockActions}from"./floating-block-actions.js";export{BlockOptions,useBlockActions,useBlockOptionsContext}from"./block-options.js";export{FloatingToolbar}from"./floating-toolbar.js";export{ActionMenuList}from"./action-menu-list.js";export{Portal}from"./portal.js";export{Overlay}from"./overlay.js";export{H as HighlightColorPicker}from"./chunks/highlight-color-picker-
|
|
1
|
+
export{SlashCommandMenu}from"./slash-command-menu.js";export{ElementOptions,useElementOptions,useElementOptionsContext,useUpdateElementProps}from"./element-options.js";export{FloatingBlockActions}from"./floating-block-actions.js";export{BlockOptions,useBlockActions,useBlockOptionsContext}from"./block-options.js";export{FloatingToolbar}from"./floating-toolbar.js";export{ActionMenuList}from"./action-menu-list.js";export{Portal}from"./portal.js";export{Overlay}from"./overlay.js";export{H as HighlightColorPicker}from"./chunks/highlight-color-picker-a1a292a9.js";export{SelectionBox,useRectangeSelectionBox}from"./selection-box.js";export{BlockDndContext,DragHandle,SortableBlock,getOrderedBlockIds,useBlockDnd,useBlockDndContext}from"./block-dnd.js";import"react/jsx-runtime";import"react";import"@yoopta/editor";import"./chunks/floating-ui.react-b048728e.js";import"react-dom";import"./chunks/style-inject.es-e87a8d02.js";import"./chunks/index-e0185864.js";import"./chunks/_tslib-5e145dfd.js";import"./chunks/throttle-dea4a39e.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;"}
|
package/dist/overlay.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as o}from"./chunks/_tslib-5e145dfd.js";import{jsx as l}from"react/jsx-runtime";import{k as r}from"./chunks/floating-ui.react-
|
|
1
|
+
import{_ as o}from"./chunks/_tslib-5e145dfd.js";import{jsx as l}from"react/jsx-runtime";import{k as r}from"./chunks/floating-ui.react-b048728e.js";import"react";import"react-dom";const c=c=>{var{className:a,children:s,lockScroll:n=!0}=c,t=o(c,["className","children","lockScroll"]);return l(r,Object.assign({lockScroll:n,className:a},t,{onClick:o=>{var l;o.stopPropagation(),null===(l=t.onClick)||void 0===l||l.call(t,o)},onMouseDown:o=>{var l;o.stopPropagation(),null===(l=t.onMouseDown)||void 0===l||l.call(t,o)}},{children:s}))};export{c as Overlay};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"overlay.js","sources":["../src/overlay/Overlay.tsx"],"sourcesContent":["import type { MouseEvent, ReactNode } from 'react';\nimport { FloatingOverlay } from '@floating-ui/react';\n\ntype Props = {\n children: ReactNode;\n lockScroll?: boolean;\n className?: string;\n onClick?: (e: MouseEvent) => void;\n onMouseDown?: (e: MouseEvent) => void;\n style?: React.CSSProperties;\n};\n\nconst Overlay = ({ className, children, lockScroll = true, ...props }: Props) => {\n const onMouseDown = (e: MouseEvent) => {\n e.stopPropagation();\n props.onMouseDown?.(e);\n };\n\n const onClick = (e: MouseEvent) => {\n e.stopPropagation();\n props.onClick?.(e);\n };\n\n return (\n <FloatingOverlay\n lockScroll={lockScroll}\n className={className}\n {...props}\n onClick={onClick}\n onMouseDown={onMouseDown}>\n {children}\n </FloatingOverlay>\n );\n};\n\nexport { Overlay };\n\n"],"names":["_jsx"],"mappings":";;;;;;AAYA,MAAM,OAAO,GAAG,CAAC,EAA2D,KAAI;AAA/D,IAAA,IAAA,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,GAAG,IAAI,EAAA,GAAA,EAAmB,EAAd,KAAK,GAAlD,MAAA,CAAA,EAAA,EAAA,CAAA,WAAA,EAAA,UAAA,EAAA,YAAA,CAAoD,CAAF,CAAA;AACjE,IAAA,MAAM,WAAW,GAAG,CAAC,CAAa,KAAI;;QACpC,CAAC,CAAC,eAAe,EAAE,CAAC;AACpB,QAAA,CAAA,EAAA,GAAA,KAAK,CAAC,WAAW,MAAG,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,IAAA,CAAA,KAAA,EAAA,CAAC,CAAC,CAAC;AACzB,KAAC,CAAC;AAEF,IAAA,MAAM,OAAO,GAAG,CAAC,CAAa,KAAI;;QAChC,CAAC,CAAC,eAAe,EAAE,CAAC;AACpB,QAAA,CAAA,EAAA,GAAA,KAAK,CAAC,OAAO,MAAG,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,IAAA,CAAA,KAAA,EAAA,CAAC,CAAC,CAAC;AACrB,KAAC,CAAC;IAEF,QACEA,GAAC,CAAA,eAAe,EACd,MAAA,CAAA,MAAA,CAAA,EAAA,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,SAAS,EAAA,EAChB,KAAK,EACT,EAAA,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,WAAW,EACvB,EAAA,EAAA,QAAA,EAAA,QAAQ,EACO,CAAA,CAAA,EAClB;AACJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Portal.d.ts","sourceRoot":"","sources":["../../src/portal/Portal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKvC,KAAK,KAAK,GAAG;IACX,QAAQ,EAAE,SAAS,CAAC;IACpB,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;
|
|
1
|
+
{"version":3,"file":"Portal.d.ts","sourceRoot":"","sources":["../../src/portal/Portal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKvC,KAAK,KAAK,GAAG;IACX,QAAQ,EAAE,SAAS,CAAC;IACpB,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAmBF,QAAA,MAAM,MAAM,UAAW,KAAK,mDAkD3B,CAAC;AAEF,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
package/dist/portal.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as r}from"react/jsx-runtime";import{
|
|
1
|
+
import{jsx as r}from"react/jsx-runtime";import{useRef as e,useState as t,useLayoutEffect as n}from"react";import{F as c}from"./chunks/floating-ui.react-b048728e.js";import{useYooptaEditor as o}from"@yoopta/editor";import"react-dom";const u=new WeakMap,a=r=>{let e=r.querySelector(".yoopta-portal-container");return e||(e=document.createElement("div"),e.className="yoopta-portal-container",r.appendChild(e),u.set(e,0)),e},i=i=>{var l;const m=o(),s=e(null),[,d]=t(0);if(!s.current&&m.refElement){s.current=a(m.refElement);const r=null!==(l=u.get(s.current))&&void 0!==l?l:0;u.set(s.current,r+1)}return n(()=>{var r;const e=m.refElement;if(e){if(!s.current||!e.contains(s.current)){s.current=a(e);const t=null!==(r=u.get(s.current))&&void 0!==r?r:0;u.set(s.current,t+1),d(r=>r+1)}return()=>{var r;if(s.current){const e=null!==(r=u.get(s.current))&&void 0!==r?r:0,t=Math.max(0,e-1);u.set(s.current,t),0===t&&s.current.parentNode&&(s.current.remove(),u.delete(s.current)),s.current=null}}}},[m.refElement]),s.current?r(c,Object.assign({id:`${i.id}-${m.id}`,root:s.current},{children:i.children})):null};export{i as Portal};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"portal.js","sources":["../src/portal/Portal.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { useLayoutEffect, useRef, useState } from 'react';\nimport { FloatingPortal } from '@floating-ui/react';\nimport { useYooptaEditor } from '@yoopta/editor';\n\ntype Props = {\n children: ReactNode;\n id: string;\n};\n\n// Global map to track portal container usage count per editor\nconst portalContainerRefs = new WeakMap<HTMLElement, number>();\n\n// Get or create portal container synchronously\nconst getOrCreatePortalContainer = (editorEl: HTMLElement): HTMLElement => {\n let portalContainer = editorEl.querySelector('.yoopta-portal-container') as HTMLElement;\n\n if (!portalContainer) {\n portalContainer = document.createElement('div');\n portalContainer.className = 'yoopta-portal-container';\n editorEl.appendChild(portalContainer);\n portalContainerRefs.set(portalContainer, 0);\n }\n\n return portalContainer;\n};\n\nconst Portal = (props: Props) => {\n const editor = useYooptaEditor();\n const rootElRef = useRef<HTMLElement | null>(null);\n const [, forceUpdate] = useState(0);\n\n // Initialize portal container synchronously on first render\n if (!rootElRef.current && editor.refElement) {\n rootElRef.current = getOrCreatePortalContainer(editor.refElement);\n // Increment usage count\n const currentCount = portalContainerRefs.get(rootElRef.current) ?? 0;\n portalContainerRefs.set(rootElRef.current, currentCount + 1);\n }\n\n // Handle cleanup and editor changes\n useLayoutEffect(() => {\n const editorEl = editor.refElement;\n if (!editorEl) return;\n\n // If rootEl doesn't match current editor, update it\n if (!rootElRef.current || !editorEl.contains(rootElRef.current)) {\n rootElRef.current = getOrCreatePortalContainer(editorEl);\n const currentCount = portalContainerRefs.get(rootElRef.current) ?? 0;\n portalContainerRefs.set(rootElRef.current, currentCount + 1);\n forceUpdate((n) => n + 1);\n }\n\n return () => {\n if (rootElRef.current) {\n // Decrement usage count\n const count = portalContainerRefs.get(rootElRef.current) ?? 0;\n const newCount = Math.max(0, count - 1);\n portalContainerRefs.set(rootElRef.current, newCount);\n\n // Only remove container if no portals are using it\n if (newCount === 0 && rootElRef.current.parentNode) {\n rootElRef.current.remove();\n portalContainerRefs.delete(rootElRef.current);\n }\n rootElRef.current = null;\n }\n };\n }, [editor.refElement]);\n\n if (!rootElRef.current) return null;\n\n return (\n <FloatingPortal id={`${props.id}-${editor.id}`} root={rootElRef.current}>\n {props.children}\n </FloatingPortal>\n );\n};\n\nexport { Portal };\n"],"names":["_jsx"],"mappings":";;;;;;AAUA;AACA,MAAM,mBAAmB,GAAG,IAAI,OAAO,EAAuB,CAAC;AAE/D;AACA,MAAM,0BAA0B,GAAG,CAAC,QAAqB,KAAiB;IACx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AC,SAAS,CAAC,OAAO;AAAE,QAAA,OAAO,IAAI,CAAC;IAEpC,QACEA,GAAC,CAAA,cAAc,EAAC,MAAA,CAAA,MAAA,CAAA,EAAA,EAAE,EAAE,CAAA,EAAG,KAAK,CAAC,EAAE,CAAA,CAAA,EAAI,MAAM,CAAC,EAAE,CAAA,CAAE,EAAE,IAAI,EAAE,SAAS,CAAC,OAAO,EACpE,EAAA,EAAA,QAAA,EAAA,KAAK,CAAC,QAAQ,EACA,CAAA,CAAA,EACjB;AACJ;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selection-box.js","sources":["../src/selection-box/hooks.ts","../src/selection-box/SelectionBox.tsx"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\nimport { Paths, type YooEditor } from '@yoopta/editor';\n\nimport type { RectangeSelectionProps, RectangeSelectionState } from './SelectionBox';\n\ntype Coords = [number, number];\n\nconst findBlocksUnderSelection = (editor: YooEditor, origin: Coords, coords: Coords): number[] => {\n const blocksUnderSelection: number[] = [];\n const blocks = editor.refElement?.querySelectorAll(`[data-yoopta-block]`);\n\n if (!blocks) return blocksUnderSelection;\n\n const selectionRect = {\n top: Math.min(origin[1], coords[1]),\n left: Math.min(origin[0], coords[0]),\n bottom: Math.max(origin[1], coords[1]),\n right: Math.max(origin[0], coords[0]),\n };\n\n blocks.forEach((blockEl, i) => {\n const blockRect = blockEl.getBoundingClientRect();\n\n if (\n selectionRect.top < blockRect.bottom &&\n selectionRect.bottom > blockRect.top &&\n selectionRect.left < blockRect.right &&\n selectionRect.right > blockRect.left\n ) {\n blocksUnderSelection.push(i);\n }\n });\n\n return blocksUnderSelection;\n};\n\ntype RectangeSelectionReturn = RectangeSelectionState & {\n onClose: () => void;\n};\n\nconst INITIAL_STATE: RectangeSelectionState = {\n origin: [0, 0],\n coords: [0, 0],\n selection: false,\n};\n\n// [TODO] - Fix selection when multiple editors\nexport const useRectangeSelectionBox = ({\n editor,\n root,\n}: RectangeSelectionProps): RectangeSelectionReturn => {\n const [state, setState] = useState<RectangeSelectionState>(INITIAL_STATE);\n\n // Use refs to avoid stale closures in event handlers\n const stateRef = useRef(state);\n stateRef.current = state;\n\n const onClose = useCallback(() => {\n setState(INITIAL_STATE);\n }, []);\n\n useEffect(() => {\n if (editor.readOnly) return;\n\n const getRootElement = (): HTMLElement | Document | null => {\n if (root && 'current' in root) return root.current;\n if (root) return root;\n return null;\n };\n\n const elementMouseEl = getRootElement();\n\n // Skip if root element is not yet available (e.g., ref not mounted)\n if (!elementMouseEl) return;\n\n if (editor.refElement?.contains(elementMouseEl as Node)) {\n throw new Error(\n 'Root element should not be a child of the editor. Please check the `selectionBoxElement` prop',\n );\n }\n\n const onMouseDown = (event: MouseEvent) => {\n const isInsideEditor = editor.refElement?.contains(event.target as Node);\n const selectedBlocks = Paths.getSelectedPaths(editor);\n\n if (\n !isInsideEditor &&\n !stateRef.current.selection &&\n Array.isArray(selectedBlocks) &&\n selectedBlocks.length > 0\n ) {\n editor.setPath({ current: null });\n onClose();\n return;\n }\n\n if (isInsideEditor) return;\n\n const coords: Coords = [event.pageX, event.pageY - window.scrollY];\n setState({\n origin: coords,\n coords,\n selection: true,\n });\n };\n\n const onMouseMove = (event: MouseEvent) => {\n if (!stateRef.current.selection) return;\n\n const newCoords: Coords = [event.pageX, event.pageY - window.scrollY];\n\n setState((prevState) => ({\n ...prevState,\n coords: newCoords,\n }));\n\n const blocksUnderSelection = findBlocksUnderSelection(\n editor,\n stateRef.current.origin,\n newCoords,\n );\n\n editor.setPath({ current: null, selected: blocksUnderSelection, source: 'selection-box' });\n };\n\n const onMouseUp = () => {\n if (stateRef.current.selection) {\n onClose();\n }\n };\n\n elementMouseEl.addEventListener('mousedown', onMouseDown as EventListener);\n elementMouseEl.addEventListener('mousemove', onMouseMove as EventListener);\n elementMouseEl.addEventListener('mouseup', onMouseUp);\n\n return () => {\n elementMouseEl.removeEventListener('mousedown', onMouseDown as EventListener);\n elementMouseEl.removeEventListener('mousemove', onMouseMove as EventListener);\n elementMouseEl.removeEventListener('mouseup', onMouseUp);\n };\n }, [editor, root, onClose]);\n\n return {\n ...state,\n onClose,\n };\n};\n\n","import type { CSSProperties } from 'react';\nimport { useMemo } from 'react';\nimport type { YooEditor } from '@yoopta/editor';\nimport { useYooptaEditor, useYooptaReadOnly } from '@yoopta/editor';\n\nimport { useRectangeSelectionBox } from './hooks';\n\nexport type SelectionBoxRoot = HTMLElement | { current: HTMLElement | null };\n\nexport type RectangeSelectionProps = {\n editor: YooEditor;\n root?: SelectionBoxRoot;\n};\n\nexport type RectangeSelectionState = {\n origin: [number, number];\n coords: [number, number];\n selection: boolean;\n};\n\nexport type SelectionBoxProps = {\n selectionBoxElement?: SelectionBoxRoot | null;\n};\n\nconst getTransform = (origin: [number, number], coords: [number, number]): string | undefined => {\n if (origin[1] > coords[1] && origin[0] > coords[0]) return 'scaleY(-1) scaleX(-1)';\n if (origin[1] > coords[1]) return 'scaleY(-1)';\n if (origin[0] > coords[0]) return 'scaleX(-1)';\n return undefined;\n};\n\nconst SelectionBox = ({ selectionBoxElement }: SelectionBoxProps) => {\n const editor = useYooptaEditor();\n const isReadOnly = useYooptaReadOnly();\n const { coords, origin, selection } = useRectangeSelectionBox({\n editor,\n root: selectionBoxElement ?? undefined,\n });\n\n const selectionBoxStyle = useMemo<CSSProperties>(\n () => ({\n zIndex: 10,\n left: origin[0],\n top: origin[1],\n height: Math.abs(coords[1] - origin[1] - 1),\n width: Math.abs(coords[0] - origin[0] - 1),\n userSelect: 'none',\n transformOrigin: 'top left',\n transform: getTransform(origin, coords),\n position: 'fixed',\n backgroundColor: 'rgba(35, 131, 226, 0.14)',\n }),\n [origin, coords],\n );\n\n if (!selection || isReadOnly) return null;\n\n return <div style={selectionBoxStyle} />;\n};\n\nexport { SelectionBox };\n\n"],"names":["_jsx"],"mappings":";;;;AAOA,MAAM,wBAAwB,GAAG,CAAC,MAAiB,EAAE,MAAc,EAAE,MAAc,KAAc;;IAC/F,M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