@yoopta/themes-shadcn 6.0.1 → 6.0.3
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/accordion.js +1 -1
- package/dist/applyTheme.d.ts.map +1 -1
- package/dist/carousel.js +1 -1
- package/dist/chunks/button-f335deaa.js +1 -0
- package/dist/chunks/{dropdown-menu-eb328f8d.js → dropdown-menu-36750aec.js} +3 -3
- package/dist/chunks/{hover-card-d6a71398.js → hover-card-8048e9ce.js} +1 -1
- package/dist/chunks/index-371259c9.js +1 -0
- package/dist/chunks/{index-f85dae42.js → index-5b487f4e.js} +1 -1
- package/dist/chunks/{index-ba3032f8.js → index-a77c7d53.js} +1 -1
- package/dist/chunks/{index-23db6fea.js → index-bd6363d4.js} +1 -1
- package/dist/chunks/label-35a74462.js +1 -0
- package/dist/chunks/{language-select-89735035.js → language-select-ee2698cf.js} +1 -1
- package/dist/chunks/pen-d6258303.js +7 -0
- package/dist/chunks/popover-dae0ce5f.js +1 -0
- package/dist/chunks/{scroll-area-dae47c2c.js → scroll-area-8321348a.js} +1 -1
- package/dist/chunks/{select-a8bcd8b5.js → select-a3724728.js} +1 -1
- package/dist/chunks/separator-f4e74aca.js +1 -0
- package/dist/chunks/{tabs-294764a6.js → tabs-370c3f2c.js} +1 -1
- package/dist/chunks/{tooltip-65b9c3a0.js → tooltip-5defff1d.js} +2 -2
- package/dist/code-group.js +1 -1
- package/dist/code.js +1 -1
- package/dist/divider.js +1 -1
- package/dist/embed/elements/embed/embed-element.d.ts +1 -1
- package/dist/embed/elements/embed/embed-element.d.ts.map +1 -1
- package/dist/embed/elements/embed/embed-inline-toolbar.d.ts.map +1 -1
- package/dist/embed/elements/embed/embed-render.d.ts.map +1 -1
- package/dist/embed/index.d.ts +1 -1
- package/dist/embed.js +2 -2
- package/dist/emoji.js +1 -1
- package/dist/file/elements/file/file-element.d.ts +1 -1
- package/dist/file/elements/file/file-element.d.ts.map +1 -1
- package/dist/file/elements/file/file-inline-toolbar.d.ts.map +1 -1
- package/dist/file/index.d.ts +1 -1
- package/dist/file.js +3 -3
- package/dist/image/elements/image/image-element.d.ts +1 -1
- package/dist/image/elements/image/image-element.d.ts.map +1 -1
- package/dist/image/elements/image/image-inline-toolbar.d.ts.map +1 -1
- package/dist/image/elements/image/image-render.d.ts.map +1 -1
- package/dist/image/index.d.ts +1 -1
- package/dist/image.js +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/link.js +1 -7
- package/dist/math/elements/math/math-edit.d.ts +13 -0
- package/dist/math/elements/math/math-edit.d.ts.map +1 -0
- package/dist/math/elements/math/math-element.d.ts +3 -0
- package/dist/math/elements/math/math-element.d.ts.map +1 -0
- package/dist/math/elements/math/math-preview.d.ts +10 -0
- package/dist/math/elements/math/math-preview.d.ts.map +1 -0
- package/dist/math/elements/math-block/math-block-element.d.ts +3 -0
- package/dist/math/elements/math-block/math-block-element.d.ts.map +1 -0
- package/dist/math/index.d.ts +15 -0
- package/dist/math/index.d.ts.map +1 -0
- package/dist/math.js +1 -0
- package/dist/mention.js +3 -3
- package/dist/steps/elements/steps-list-item.d.ts.map +1 -1
- package/dist/steps.js +1 -1
- package/dist/table-of-contents/elements/table-of-contents.d.ts.map +1 -1
- package/dist/table-of-contents.js +1 -1
- package/dist/table.js +3 -3
- package/dist/tabs.js +1 -1
- package/dist/video/elements/video/video-element.d.ts +1 -1
- package/dist/video/elements/video/video-element.d.ts.map +1 -1
- package/dist/video/elements/video/video-inline-toolbar.d.ts.map +1 -1
- package/dist/video/elements/video/video-render.d.ts.map +1 -1
- package/dist/video/index.d.ts +1 -1
- package/dist/video.js +2 -2
- package/package.json +21 -14
- package/dist/accordion.js.map +0 -1
- package/dist/blockquote.js.map +0 -1
- package/dist/callout.js.map +0 -1
- package/dist/carousel.js.map +0 -1
- package/dist/chunks/Combination-3c924518.js +0 -1080
- package/dist/chunks/Combination-3c924518.js.map +0 -1
- package/dist/chunks/_tslib-514d60fe.js +0 -67
- package/dist/chunks/_tslib-514d60fe.js.map +0 -1
- package/dist/chunks/arrow-right-5ddace59.js +0 -30
- package/dist/chunks/arrow-right-5ddace59.js.map +0 -1
- package/dist/chunks/button-27a1fbc2.js +0 -76
- package/dist/chunks/button-27a1fbc2.js.map +0 -1
- package/dist/chunks/button-7aec29d6.js +0 -1
- package/dist/chunks/card-12ed876a.js +0 -38
- package/dist/chunks/card-12ed876a.js.map +0 -1
- package/dist/chunks/check-9acc031a.js +0 -14
- package/dist/chunks/check-9acc031a.js.map +0 -1
- package/dist/chunks/chevron-down-7424d0c3.js +0 -16
- package/dist/chunks/chevron-down-7424d0c3.js.map +0 -1
- package/dist/chunks/chevron-up-546faa64.js +0 -14
- package/dist/chunks/chevron-up-546faa64.js.map +0 -1
- package/dist/chunks/code-5407bf8e.js +0 -17
- package/dist/chunks/code-5407bf8e.js.map +0 -1
- package/dist/chunks/createLucideIcon-6ba35914.js +0 -56
- package/dist/chunks/createLucideIcon-6ba35914.js.map +0 -1
- package/dist/chunks/dropdown-menu-9ba446af.js +0 -1250
- package/dist/chunks/dropdown-menu-9ba446af.js.map +0 -1
- package/dist/chunks/external-link-1bf3c7a2.js +0 -18
- package/dist/chunks/external-link-1bf3c7a2.js.map +0 -1
- package/dist/chunks/file-text-9e348575.js +0 -23
- package/dist/chunks/file-text-9e348575.js.map +0 -1
- package/dist/chunks/hover-card-22a4067b.js +0 -258
- package/dist/chunks/hover-card-22a4067b.js.map +0 -1
- package/dist/chunks/index-0c94b090.js +0 -222
- package/dist/chunks/index-0c94b090.js.map +0 -1
- package/dist/chunks/index-12e7c5fd.js +0 -155
- package/dist/chunks/index-12e7c5fd.js.map +0 -1
- package/dist/chunks/index-23c7fb16.js +0 -1
- package/dist/chunks/index-26994c9d.js +0 -131
- package/dist/chunks/index-26994c9d.js.map +0 -1
- package/dist/chunks/index-600be8f8.js +0 -190
- package/dist/chunks/index-600be8f8.js.map +0 -1
- package/dist/chunks/index-7e966ec9.js +0 -16
- package/dist/chunks/index-7e966ec9.js.map +0 -1
- package/dist/chunks/index-9ac5afe2.js +0 -201
- package/dist/chunks/index-9ac5afe2.js.map +0 -1
- package/dist/chunks/index-9bb7ddb4.js +0 -104
- package/dist/chunks/index-9bb7ddb4.js.map +0 -1
- package/dist/chunks/index-ae9b48d5.js +0 -12
- package/dist/chunks/index-ae9b48d5.js.map +0 -1
- package/dist/chunks/index-b26053ec.js +0 -3805
- package/dist/chunks/index-b26053ec.js.map +0 -1
- package/dist/chunks/index-b8f2908d.js +0 -40
- package/dist/chunks/index-b8f2908d.js.map +0 -1
- package/dist/chunks/index-c655a86f.js +0 -7
- package/dist/chunks/index-c655a86f.js.map +0 -1
- package/dist/chunks/index-d9171717.js +0 -13
- package/dist/chunks/index-d9171717.js.map +0 -1
- package/dist/chunks/index-e42d0aaf.js +0 -36
- package/dist/chunks/index-e42d0aaf.js.map +0 -1
- package/dist/chunks/index-ebc47eac.js +0 -2765
- package/dist/chunks/index-ebc47eac.js.map +0 -1
- package/dist/chunks/index-ffe23855.js +0 -71
- package/dist/chunks/index-ffe23855.js.map +0 -1
- package/dist/chunks/input-7c5e4260.js +0 -13
- package/dist/chunks/input-7c5e4260.js.map +0 -1
- package/dist/chunks/label-21d46c31.js +0 -1
- package/dist/chunks/label-2a076b3f.js +0 -70
- package/dist/chunks/label-2a076b3f.js.map +0 -1
- package/dist/chunks/language-select-b35256ab.js +0 -12
- package/dist/chunks/language-select-b35256ab.js.map +0 -1
- package/dist/chunks/play-c2a06e4e.js +0 -16
- package/dist/chunks/play-c2a06e4e.js.map +0 -1
- package/dist/chunks/plus-f36f52e8.js +0 -17
- package/dist/chunks/plus-f36f52e8.js.map +0 -1
- package/dist/chunks/popover-4b5c0941.js +0 -385
- package/dist/chunks/popover-4b5c0941.js.map +0 -1
- package/dist/chunks/popover-8e6ee2ab.js +0 -1
- package/dist/chunks/scroll-area-8dc03d8f.js +0 -727
- package/dist/chunks/scroll-area-8dc03d8f.js.map +0 -1
- package/dist/chunks/select-88f1b66c.js +0 -1281
- package/dist/chunks/select-88f1b66c.js.map +0 -1
- package/dist/chunks/separator-219dc1f7.js +0 -1
- package/dist/chunks/separator-a6b3e5d2.js +0 -74
- package/dist/chunks/separator-a6b3e5d2.js.map +0 -1
- package/dist/chunks/settings-2-8e53118c.js +0 -19
- package/dist/chunks/settings-2-8e53118c.js.map +0 -1
- package/dist/chunks/sparkles-a0316be3.js +0 -26
- package/dist/chunks/sparkles-a0316be3.js.map +0 -1
- package/dist/chunks/style-inject.es-746bb8ed.js +0 -29
- package/dist/chunks/style-inject.es-746bb8ed.js.map +0 -1
- package/dist/chunks/tabs-38ee85c4.js +0 -205
- package/dist/chunks/tabs-38ee85c4.js.map +0 -1
- package/dist/chunks/tooltip-eb8a0f63.js +0 -1671
- package/dist/chunks/tooltip-eb8a0f63.js.map +0 -1
- package/dist/chunks/trash-2-41ddec45.js +0 -20
- package/dist/chunks/trash-2-41ddec45.js.map +0 -1
- package/dist/chunks/upload-b987996c.js +0 -44
- package/dist/chunks/upload-b987996c.js.map +0 -1
- package/dist/chunks/utils-208f599b.js +0 -2500
- package/dist/chunks/utils-208f599b.js.map +0 -1
- package/dist/chunks/x-f7edc87d.js +0 -17
- package/dist/chunks/x-f7edc87d.js.map +0 -1
- package/dist/code-group.js.map +0 -1
- package/dist/code.js.map +0 -1
- package/dist/divider.js.map +0 -1
- package/dist/embed.js.map +0 -1
- package/dist/emoji.js.map +0 -1
- package/dist/file.js.map +0 -1
- package/dist/headings.js.map +0 -1
- package/dist/image.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/link.js.map +0 -1
- package/dist/lists.js.map +0 -1
- package/dist/mention.js.map +0 -1
- package/dist/paragraph.js.map +0 -1
- package/dist/steps.js.map +0 -1
- package/dist/table-of-contents.js.map +0 -1
- package/dist/table.js.map +0 -1
- package/dist/tabs.js.map +0 -1
- package/dist/video.js.map +0 -1
package/dist/table.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t,Fragment as l}from"react/jsx-runtime";import{forwardRef as o,useState as n,useRef as r,useEffect as a,useCallback as s,useMemo as i}from"react";import{useYooptaEditor as c,Blocks as d}from"@yoopta/editor";import{TableCommands as u,TABLE_CELLS_IN_SELECTION as m,TABLE_SLATE_TO_SELECTION_SET as h}from"@yoopta/table";import{useElementOptions as b,useUpdateElementProps as p,ElementOptions as g}from"@yoopta/ui/element-options";import{_ as v}from"./chunks/_tslib-35bb891d.js";import{c as f}from"./chunks/utils-3345eade.js";import{Portal as y}from"@yoopta/ui/portal";import{Editor as w,Element as x}from"slate";import{B as k}from"./chunks/button-
|
|
1
|
+
import{jsx as e,jsxs as t,Fragment as l}from"react/jsx-runtime";import{forwardRef as o,useState as n,useRef as r,useEffect as a,useCallback as s,useMemo as i}from"react";import{useYooptaEditor as c,Blocks as d}from"@yoopta/editor";import{TableCommands as u,TABLE_CELLS_IN_SELECTION as m,TABLE_SLATE_TO_SELECTION_SET as h}from"@yoopta/table";import{useElementOptions as b,useUpdateElementProps as p,ElementOptions as g}from"@yoopta/ui/element-options";import{_ as v}from"./chunks/_tslib-35bb891d.js";import{c as f}from"./chunks/utils-3345eade.js";import{Portal as y}from"@yoopta/ui/portal";import{Editor as w,Element as x}from"slate";import{B as k}from"./chunks/button-f335deaa.js";import{P as j}from"./chunks/plus-840fe920.js";import{D as N,a as C,b as O,c as M,e as z,M as E,A as L,d as I,f as $,g as S,h as B}from"./chunks/dropdown-menu-36750aec.js";import{c as R}from"./chunks/createLucideIcon-8605f860.js";import{A as T,a as q}from"./chunks/arrow-right-38c3a9bd.js";import{T as A}from"./chunks/trash-2-f36597ff.js";import{L as D}from"./chunks/label-35a74462.js";import{P as H,a as P,b as G}from"./chunks/popover-dae0ce5f.js";import{S as _}from"./chunks/separator-f4e74aca.js";import{C as V}from"./chunks/chevron-down-28dfb290.js";import{s as F}from"./chunks/style-inject.es-e87a8d02.js";import"./chunks/index-17323747.js";import"react-dom";import"./chunks/index-91a5b8d5.js";import"./chunks/index-ff0e3962.js";import"./chunks/index-5b487f4e.js";import"./chunks/index-13505606.js";import"./chunks/index-371259c9.js";import"./chunks/index-70f4e709.js";import"./chunks/Combination-575d4475.js";import"./chunks/index-ce60ba41.js";import"./chunks/index-bd6363d4.js";import"./chunks/index-a77c7d53.js";import"./chunks/index-a5cba5f7.js";
|
|
2
2
|
/**
|
|
3
3
|
* @license lucide-react v0.294.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
|
-
*/const
|
|
7
|
+
*/const W=R("Eraser",[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]]),X=R("Merge",[["path",{d:"m8 6 4-4 4 4",key:"ybng9g"}],["path",{d:"M12 2v10.3a4 4 0 0 1-1.172 2.872L4 22",key:"1hyw0i"}],["path",{d:"m20 22-5-5",key:"1m27yz"}]]),Y=R("MoreHorizontal",[["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"}]]),J=R("MoveHorizontal",[["polyline",{points:"18 8 22 12 18 16",key:"1hqrds"}],["polyline",{points:"6 8 2 12 6 16",key:"f0ernq"}],["line",{x1:"2",x2:"22",y1:"12",y2:"12",key:"1dnqot"}]]),K=R("MoveVertical",[["polyline",{points:"8 18 12 22 16 18",key:"1uutw3"}],["polyline",{points:"8 6 12 2 16 6",key:"d60sxy"}],["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}]]),Z=R("Paintbrush",[["path",{d:"M18.37 2.63 14 7l-1.59-1.59a2 2 0 0 0-2.82 0L8 7l9 9 1.59-1.59a2 2 0 0 0 0-2.82L17 10l4.37-4.37a2.12 2.12 0 1 0-3-3Z",key:"m6k5sh"}],["path",{d:"M9 8c-2 3-4 3.5-7 4l8 10c2-1 6-5 6-7",key:"arzq70"}],["path",{d:"M14.5 17.5 4.5 15",key:"s7fvrz"}]]),Q=R("Table2",[["path",{d:"M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18",key:"gugj83"}]]),U=R("Type",[["polyline",{points:"4 7 4 4 20 4 20 7",key:"1nosan"}],["line",{x1:"9",x2:"15",y1:"20",y2:"20",key:"swin9y"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]),ee=o((t,l)=>{var{className:o}=t,n=v(t,["className"]);return e("table",Object.assign({ref:l,"data-slot":"table",className:f("caption-bottom text-sm table-fixed border-collapse",o)},n))});
|
|
8
8
|
/**
|
|
9
9
|
* @license lucide-react v0.294.0 - ISC
|
|
10
10
|
*
|
|
11
11
|
* This source code is licensed under the ISC license.
|
|
12
12
|
* See the LICENSE file in the root directory of this source tree.
|
|
13
|
-
*/ee.displayName="Table";o((t,l)=>{var{className:o}=t,n=v(t,["className"]);return e("thead",Object.assign({ref:l,"data-slot":"table-header",className:f("[&_tr]:border-b",o)},n))}).displayName="TableHeader";const te=o((t,l)=>{var{className:o}=t,n=v(t,["className"]);return e("tbody",Object.assign({ref:l,"data-slot":"table-body",className:f("[&_tr:first-child]:border-t [&_tr]:border-b [&_tr]:border-border",o)},n))});te.displayName="TableBody";o((t,l)=>{var{className:o}=t,n=v(t,["className"]);return e("tfoot",Object.assign({ref:l,"data-slot":"table-footer",className:f("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",o)},n))}).displayName="TableFooter";const le=o((t,l)=>{var{className:o}=t,n=v(t,["className"]);return e("tr",Object.assign({ref:l,"data-slot":"table-row",className:f("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",o)},n))});le.displayName="TableRow";const oe=o((t,l)=>{var{className:o}=t,n=v(t,["className"]);return e("th",Object.assign({ref:l,"data-slot":"table-head",className:f("border-border border-r last:border-r-0 text-foreground h-10 px-2 text-left font-medium [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] bg-muted/50",o)},n))});oe.displayName="TableHead";const ne=o((t,l)=>{var{className:o}=t,n=v(t,["className"]);return e("td",Object.assign({ref:l,"data-slot":"table-cell",className:f("border-border border-r last:border-r-0 p-2 [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",o)},n))});ne.displayName="TableCell";o((t,l)=>{var{className:o}=t,n=v(t,["className"]);return e("caption",Object.assign({ref:l,"data-slot":"table-caption",className:f("text-muted-foreground mt-4 text-sm",o)},n))}).displayName="TableCaption";const re=({blockId:t})=>{const l=c(),[o,i]=n(null),[d,m]=n(!1),[h,b]=n(null),[p,g]=n([]),v=r(0),f=r(0),w=r([]),x=r(null),k=r(null),j=r(null);a(()=>{w.current=p},[p]),a(()=>{k.current=o},[o]),a(()=>{x.current=h},[h]);const N=s(()=>{const e=document.querySelector(`[data-yoopta-block-id="${t}"][data-table-container]`);if(!e)return;const l=e.querySelector("table");if(!l)return;const o=l.getBoundingClientRect();i(o);const n=l.querySelector("colgroup");j.current=n;const r=l.querySelectorAll("colgroup col"),a=l.querySelector("tr");if(r.length>0){const e=[];o.left,r.forEach((t,l)=>{const o=window.getComputedStyle(t),n=parseInt(o.width,10)||200;e.push(n)}),g(e)}else if(a){const e=a.querySelectorAll("td, th"),t=[],l=[];e.forEach((e,o)=>{const n=e.getBoundingClientRect();l.push(n.width),t.push({index:o,left:n.left,width:n.width})}),g(l)}},[t]);a(()=>{N();const e=document.querySelector(`[data-yoopta-block-id="${t}"][data-table-container]`);if(!e)return;const l=e.querySelector("table");if(!l)return;const o=new ResizeObserver(()=>{d||N()});o.observe(l);const n=new MutationObserver(()=>{d||N()});n.observe(l,{childList:!0,subtree:!0});const r=()=>{d||N()};return window.addEventListener("scroll",r,!0),()=>{o.disconnect(),n.disconnect(),window.removeEventListener("scroll",r,!0)}},[t,N,d]);const C=s(e=>{if(!j.current)return;j.current.querySelectorAll("col").forEach((t,l)=>{void 0!==e[l]&&(t.style.width=`${e[l]}px`)})},[]),O=s((e,t)=>{if(!t||0===e.length)return[];let l=t.left;return e.map((e,t)=>{const o={index:t,left:l,width:e};return l+=e,o})},[]),M=s((e,t)=>{e.preventDefault(),e.stopPropagation();const l=p[t];void 0!==l&&(m(!0),b(t),v.current=e.clientX,f.current=l,document.body.classList.add("resizing-column"))},[p]),z=s(e=>{const t=x.current;if(null===t)return;const l=e.clientX-v.current,o=Math.max(50,f.current+l),n=[...w.current];n[t]=o,g(n),C(n)},[C]),E=s(()=>{const e=x.current,o=w.current;null!==e&&void 0!==o[e]&&u.setColumnWidth(l,t,e,o[e]),m(!1),b(null),document.body.classList.remove("resizing-column"),setTimeout(N,50)},[l,t,N]);if(a(()=>{if(d)return document.addEventListener("mousemove",z),document.addEventListener("mouseup",E),()=>{document.removeEventListener("mousemove",z),document.removeEventListener("mouseup",E)}},[d,z,E]),!o||0===p.length)return null;const L=O(p,o).slice(0,-1).map(t=>{const l=t.left+t.width-3;return e("div",{className:"column-resize-handle",style:{position:"fixed",left:`${l}px`,top:`${o.top}px`,width:"6px",height:`${o.height}px`,cursor:"col-resize",zIndex:50,backgroundColor:d&&h===t.index?"hsl(var(--primary))":"transparent"},onMouseDown:e=>M(e,t.index),onMouseEnter:e=>{d||(e.target.style.backgroundColor="hsl(var(--primary) / 0.3)")},onMouseLeave:e=>{d||(e.target.style.backgroundColor="transparent")}},`resize-${t.index}`)});return e(y,Object.assign({id:"column-resize-handles-container"},{children:e("div",Object.assign({className:"column-resize-handles-container",style:{pointerEvents:d?"auto":void 0}},{children:L}))}))},ae=({blockId:t,totalColumns:l,position:o,onMouseEnter:n,onMouseLeave:r})=>{const a=c(),i=s(()=>{const e=[0,0,l-1,0];u.insertTableColumn(a,t,{path:e,insertMode:"after"})},[a,t,l]);return e(y,Object.assign({id:`table-add-column-button-${t}`},{children:e("div",Object.assign({className:"fixed z-[9999] pointer-events-auto",style:{left:`${o.left+4}px`,top:`${o.top}px`,width:"18px",height:`${o.height}px`},onMouseEnter:n,onMouseLeave:r},{children:e(k,Object.assign({variant:"ghost",size:"sm",className:"p-0 h-full w-full bg-background/95 hover:bg-accent border border-border/50 shadow-sm rounded-md transition-all hover:shadow-md flex items-center justify-center text-muted-foreground hover:text-foreground",onClick:i,onMouseDown:e=>e.preventDefault()},{children:e(j,{className:"h-3 w-3"})}))}))}))},se=({blockId:t,totalRows:l,position:o,onMouseEnter:n,onMouseLeave:r})=>{const a=c(),i=s(()=>{const e=[0,l-1,0,0];u.insertTableRow(a,t,{path:e,insertMode:"after"})},[a,t,l]);return e(y,Object.assign({id:`table-add-row-button-${t}`},{children:e("div",Object.assign({className:"fixed z-[9999] pointer-events-auto",style:{left:`${o.left}px`,top:`${o.top+4}px`,width:`${o.width}px`,height:"18px"},onMouseEnter:n,onMouseLeave:r},{children:e(k,Object.assign({variant:"ghost",size:"sm",className:"h-full w-full bg-background/95 hover:bg-accent border border-border/50 shadow-sm rounded-md transition-all hover:shadow-md flex items-center justify-center gap-1.5 text-muted-foreground hover:text-foreground",onClick:i,onMouseDown:e=>e.preventDefault()},{children:e(j,{className:"h-3 w-3"})}))}))}))},ie=({blockId:o,colIndex:n,position:r,onMouseEnter:a,onMouseLeave:d})=>{const m=c(),h=i(()=>[0,0,n,0],[n]),b=s(()=>{u.insertTableColumn(m,o,{path:h,insertMode:"before"})},[m,o,h]),p=s(()=>{u.insertTableColumn(m,o,{path:h,insertMode:"after"})},[m,o,h]),g=s(()=>{u.deleteTableColumn(m,o,{path:h})},[m,o,h]),v=s(()=>{u.toggleHeaderColumn(m,o)},[m,o]);return e(y,Object.assign({id:`table-column-controls-${o}-${n}`},{children:e("div",Object.assign({className:"fixed z-[9999] pointer-events-auto",style:{left:`${r.left}px`,top:`${r.top+4}px`,width:`${r.width}px`,height:"18px"},onMouseEnter:a,onMouseLeave:d},{children:t(N,{children:[e(C,Object.assign({asChild:!0},{children:e(k,Object.assign({variant:"ghost",size:"sm",className:"h-full w-full bg-background/95 hover:bg-accent border border-border/50 shadow-sm rounded-md p-0 transition-all hover:shadow-md",onMouseDown:e=>e.preventDefault()},{children:e(X,{className:"h-3 w-3 text-muted-foreground"})}))})),t(O,Object.assign({align:"start",side:"top",className:"w-48"},{children:[0===n&&t(l,{children:[t(M,Object.assign({onClick:v},{children:[e(Q,{className:"mr-2 h-4 w-4"}),"Header column"]})),e(z,{})]}),t(M,Object.assign({onClick:b},{children:[e(T,{className:"mr-2 h-4 w-4"}),"Insert column left"]})),t(M,Object.assign({onClick:p},{children:[e(q,{className:"mr-2 h-4 w-4"}),"Insert column right"]})),e(z,{}),t(M,Object.assign({onClick:g,className:"text-destructive focus:text-destructive"},{children:[e(A,{className:"mr-2 h-4 w-4"}),"Delete column"]}))]}))]})}))}))},ce=({blockId:o,rowIndex:n,position:r,onMouseEnter:a,onMouseLeave:d})=>{const m=c(),h=i(()=>[0,n,0,0],[n]),b=s(()=>{u.insertTableRow(m,o,{path:h,insertMode:"before"})},[m,o,h]),p=s(()=>{u.insertTableRow(m,o,{path:h,insertMode:"after"})},[m,o,h]),g=s(()=>{u.deleteTableRow(m,o,{path:h})},[m,o,h]),v=s(()=>{u.toggleHeaderRow(m,o)},[m,o]);return e(y,Object.assign({id:`table-row-controls-${o}-${n}`},{children:e("div",Object.assign({className:"fixed z-[9998] pointer-events-auto",style:{left:`${r.left+20}px`,top:`${r.top}px`,width:"18px",height:`${r.height}px`},onMouseEnter:a,onMouseLeave:d},{children:t(N,{children:[e(C,Object.assign({asChild:!0},{children:e(k,Object.assign({variant:"ghost",size:"sm",className:"h-full w-full bg-background/95 hover:bg-accent border border-border/50 shadow-sm rounded-md p-0 transition-all hover:shadow-md flex items-center justify-center",onMouseDown:e=>e.preventDefault()},{children:e(E,{className:"h-3 w-3 text-muted-foreground"})}))})),t(O,Object.assign({align:"start",side:"left",className:"w-48"},{children:[0===n&&t(l,{children:[t(M,Object.assign({onClick:v},{children:[e(Q,{className:"mr-2 h-4 w-4"}),"Header row"]})),e(z,{})]}),t(M,Object.assign({onClick:b},{children:[e(L,{className:"mr-2 h-4 w-4"}),"Insert row above"]})),t(M,Object.assign({onClick:p},{children:[e(I,{className:"mr-2 h-4 w-4"}),"Insert row below"]})),e(z,{}),t(M,Object.assign({onClick:g,className:"text-destructive focus:text-destructive"},{children:[e(A,{className:"mr-2 h-4 w-4"}),"Delete row"]}))]}))]})}))}))},de=({blockId:o})=>{const u=c(),m=i(()=>d.getBlockSlate(u,{id:o}),[o,u]),[h,b]=n(null),[p,g]=n(!1),[v,f]=n({rowControls:null,columnControls:null,addRowButton:null,addColumnButton:null}),y=r(!1),k=r(!1),j=r(null),N=r(null);N.current=h;const C=s(()=>{var e,t;const l=N.current;if(!l)return void f({rowControls:null,columnControls:null,addRowButton:null,addColumnButton:null});const n=document.querySelector(`[data-yoopta-block-id="${o}"][data-table-container]`);if(!n)return;const r=n.querySelector(".overflow-x-auto"),a=null==r?void 0:r.getBoundingClientRect(),s=n.querySelector("table");if(!s)return;const i=s.getBoundingClientRect(),c=Array.from(n.querySelectorAll("tr")),d=c[l.rowIndex];if(!d)return;const u=Array.from(d.querySelectorAll('[data-element-type="table-data-cell"]'));if(0===u.length)return;const m=u.map(e=>e.getBoundingClientRect()),h=Math.min(...m.map(e=>e.top)),b=Math.max(...m.map(e=>e.bottom)),p=Math.min(...m.map(e=>e.left)),g=b-h,v=[];c.forEach(e=>{const t=Array.from(e.querySelectorAll('[data-element-type="table-data-cell"]'));t[l.colIndex]&&v.push(t[l.colIndex].getBoundingClientRect())});const y=v.length>0?Math.min(...v.map(e=>e.left)):p,w=v.length>0?Math.max(...v.map(e=>e.right)):p,x=w-y,k=v.length>0?Math.min(...v.map(e=>e.top)):h,j=l.rowIndex===l.totalRows-1,C=l.colIndex===l.totalColumns-1,O=!a||y>=a.left-x&&w<=a.right+x,M=null!==(e=null==a?void 0:a.left)&&void 0!==e?e:i.left,z=null!==(t=null==a?void 0:a.right)&&void 0!==t?t:i.right,E=z-M;f({rowControls:{left:Math.max(0,p-32),top:h,height:g},columnControls:O?{left:y,top:k-32,width:x}:null,addRowButton:j?{left:M,top:i.bottom,width:E}:null,addColumnButton:C?{left:Math.min(i.right,z),top:i.top,height:i.height}:null})},[o]);a(()=>{if(!h||!p)return;const e=()=>{C()};return window.addEventListener("scroll",e,!0),window.addEventListener("resize",e),C(),()=>{window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e)}},[h,p,C]);const O=s(()=>{j.current&&(clearTimeout(j.current),j.current=null)},[]),M=s(()=>{O(),j.current=setTimeout(()=>{y.current||k.current||(g(!1),b(null))},150)},[O]),z=s(e=>{if(!m)return null;const t=Array.from(w.nodes(m,{at:[0],match:t=>{if(!x.isElement(t))return!1;const l=t;return"table-data-cell"===l.type&&"id"in l&&l.id===e},mode:"all"}));if(0===t.length)return null;const[,l]=t[0],o=l[l.length-2],n=l[l.length-1],r=Array.from(w.nodes(m,{at:[0],match:e=>x.isElement(e)&&"table"===e.type,mode:"lowest"}));if(0===r.length)return null;const[a]=r[0];if(!x.isElement(a))return null;const s=a.children.length,i=a.children[0];if(!x.isElement(i))return null;const c=i.children.length;return{rowIndex:o,colIndex:n,cellElementId:e,totalRows:s,totalColumns:c}},[m]);a(()=>{const e=document.querySelector(`[data-yoopta-block-id="${o}"][data-table-container]`);if(!e||!m)return;const t=e=>{O(),y.current=!0;const t=e.target.closest('[data-element-type="table-data-cell"]');if(!t)return;const l=t.getAttribute("data-yoopta-element-id");if(!l)return;const o=N.current;if((null==o?void 0:o.cellElementId)===l)return void g(!0);const n=z(l);n&&(b(n),g(!0))},l=()=>{y.current=!1,M()};return e.addEventListener("mousemove",t),e.addEventListener("mouseleave",l),()=>{O(),e.removeEventListener("mousemove",t),e.removeEventListener("mouseleave",l)}},[o,m,z,O,M]);const E=s(()=>{O(),k.current=!0},[O]),L=s(()=>{k.current=!1,M()},[M]);return p&&h?t(l,{children:[v.rowControls&&e(ce,{blockId:o,rowIndex:h.rowIndex,position:v.rowControls,onMouseEnter:E,onMouseLeave:L}),v.columnControls&&e(ie,{blockId:o,colIndex:h.colIndex,position:v.columnControls,onMouseEnter:E,onMouseLeave:L}),v.addColumnButton&&e(ae,{blockId:o,totalColumns:h.totalColumns,position:v.addColumnButton,onMouseEnter:E,onMouseLeave:L}),v.addRowButton&&e(se,{blockId:o,totalRows:h.totalRows,position:v.addRowButton,onMouseEnter:E,onMouseLeave:L})]}):null},ue=()=>{var l,o,n,r;const{element:a}=b(),s=p(),i=null!==(l=a.props)&&void 0!==l?l:{};return e(g.Content,Object.assign({side:"bottom",align:"end",sideOffset:8,className:"min-w-[180px] rounded-lg border bg-popover p-2 shadow-md"},{children:t(g.Group,Object.assign({className:"flex flex-col gap-1.5"},{children:[e(g.Label,Object.assign({className:"px-2 text-xs font-bold text-muted-foreground"},{children:"Appearance"})),t("div",Object.assign({className:"flex items-center justify-between px-2"},{children:[e("span",Object.assign({className:"text-xs font-medium text-muted-foreground"},{children:"Bordered"})),e(g.Toggle,{checked:null===(o=i.bordered)||void 0===o||o,onCheckedChange:e=>s({bordered:e})})]})),t("div",Object.assign({className:"flex items-center justify-between px-2"},{children:[e("span",Object.assign({className:"text-xs font-medium text-muted-foreground"},{children:"Compact"})),e(g.Toggle,{checked:null!==(n=i.compact)&&void 0!==n&&n,onCheckedChange:e=>s({compact:e})})]})),t("div",Object.assign({className:"flex items-center justify-between px-2"},{children:[e("span",Object.assign({className:"text-xs font-medium text-muted-foreground"},{children:"Scrollable"})),e(g.Toggle,{checked:null===(r=i.scrollable)||void 0===r||r,onCheckedChange:e=>s({scrollable:e})})]}))]}))}))},me=[{label:"None",value:"transparent",color:"transparent"},{label:"Gray",value:"hsl(var(--muted))",color:"hsl(var(--muted))"},{label:"Red",value:"hsl(0 70% 95%)",color:"hsl(0 70% 95%)"},{label:"Orange",value:"hsl(30 70% 95%)",color:"hsl(30 70% 95%)"},{label:"Yellow",value:"hsl(60 70% 95%)",color:"hsl(60 70% 95%)"},{label:"Green",value:"hsl(120 70% 95%)",color:"hsl(120 70% 95%)"},{label:"Blue",value:"hsl(210 70% 95%)",color:"hsl(210 70% 95%)"},{label:"Purple",value:"hsl(270 70% 95%)",color:"hsl(270 70% 95%)"}],he=[{label:"Default",value:"inherit",color:"currentColor"},{label:"Gray",value:"hsl(var(--muted-foreground))",color:"hsl(var(--muted-foreground))"},{label:"Red",value:"hsl(0 70% 50%)",color:"hsl(0 70% 50%)"},{label:"Orange",value:"hsl(30 70% 50%)",color:"hsl(30 70% 50%)"},{label:"Yellow",value:"hsl(60 70% 40%)",color:"hsl(60 70% 40%)"},{label:"Green",value:"hsl(120 70% 40%)",color:"hsl(120 70% 40%)"},{label:"Blue",value:"hsl(210 70% 50%)",color:"hsl(210 70% 50%)"},{label:"Purple",value:"hsl(270 70% 50%)",color:"hsl(270 70% 50%)"}],be=({blockId:o})=>{const r=c(),s=i(()=>d.getBlockSlate(r,{id:o}),[o,r]),[h,b]=n(null),[p,g]=n(!1),[v,f]=n([]),y=s?m.get(s):[];a(()=>{f(y)},[y]);const w=Array.isArray(y)&&(null==y?void 0:y.length)>0?y:v;a(()=>{if(!s||!w||w.length<=1)return void b(null);const e=document.querySelector(`[data-yoopta-block-id="${o}"]`);if(!e)return void b(null);const t=e.getBoundingClientRect();let l=1/0,n=-1/0,r=1/0,a=-1/0;for(const[e]of w){const t=document.querySelector(`[data-yoopta-block-id="${o}"] [data-yoopta-element-id="${e.id}"]`);if(!t)continue;const s=t.getBoundingClientRect();if(!s)continue;const{top:i,bottom:c,left:d,right:u}=s;l=Math.min(l,i),n=Math.max(n,c),r=Math.min(r,d),a=Math.max(a,u)}b(l!==1/0?{top:l-t.top,left:r-t.left,width:a-r,height:n-l}:null)},[s,w,o]),a(()=>{if(!w||w.length<=1)return;const e=()=>{b(e=>e?Object.assign({},e):null)};return window.addEventListener("scroll",e,!0),window.addEventListener("resize",e),()=>{window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e)}},[w]);const x=e=>{r&&w&&0!==w.length&&(u.setCellHorizontalAlign(r,o,{cells:w,align:e}),g(!1))},j=e=>{r&&w&&0!==w.length&&(u.setCellVerticalAlign(r,o,{cells:w,align:e}),g(!1))};return h?t(l,{children:[e("div",{className:"pointer-events-none absolute z-[9999]",style:{top:`${h.top}px`,left:`${h.left}px`,width:`${h.width}px`,height:`${h.height}px`,border:"2px solid hsl(var(--primary))",backgroundColor:"hsl(var(--primary) / 0.05)",borderRadius:"2px"}}),e("div",Object.assign({className:"absolute z-20 pointer-events-auto",style:{top:`${h.top+h.height/2}px`,left:`${h.left+h.width}px`,transform:"translate(-50%, -50%)"}},{children:t(H,Object.assign({open:p,onOpenChange:g},{children:[e(P,Object.assign({asChild:!0},{children:e(k,Object.assign({variant:"secondary",size:"icon",className:"h-4 w-4 rounded-full shadow-lg bg-primary hover:bg-primary/90",onMouseDown:e=>e.preventDefault()},{children:e(E,{className:"h-3 w-3 text-primary-foreground"})}))})),e(_,Object.assign({className:"w-64 p-2",align:"start",side:"right"},{children:t("div",Object.assign({className:"space-y-2"},{children:[t(k,Object.assign({variant:"ghost",size:"sm",className:"w-full justify-start gap-2",onClick:()=>{!r||!w||w.length<=1||(u.mergeCells(r,o,{cells:w}),g(!1))},disabled:!w||w.length<=1},{children:[e(W,{className:"h-4 w-4"}),"Merge cells"]})),e(G,{}),t("div",Object.assign({className:"space-y-1"},{children:[e(D,Object.assign({className:"text-sm font-medium"},{children:"Color"})),t(N,{children:[e(C,Object.assign({asChild:!0},{children:t(k,Object.assign({variant:"outline",size:"sm",className:"w-full justify-between"},{children:[t("span",Object.assign({className:"flex items-center gap-2"},{children:[e(Z,{className:"h-4 w-4"}),"Select color"]})),e(V,{className:"h-4 w-4 opacity-50"})]}))})),t(O,Object.assign({className:"w-56",align:"start"},{children:[t($,{children:[t(S,{children:[e(Z,{className:"mr-2 h-4 w-4"}),"Background color"]}),e(B,{children:me.map(l=>e(M,Object.assign({onClick:()=>(e=>{r&&w&&0!==w.length&&(u.setCellBackgroundColor(r,o,{cells:w,color:e}),g(!1))})(l.value)},{children:t("div",Object.assign({className:"flex items-center gap-2"},{children:[e("div",{className:"h-4 w-4 rounded border",style:{backgroundColor:l.color}}),l.label]}))}),l.value))})]}),t($,{children:[t(S,{children:[e(U,{className:"mr-2 h-4 w-4"}),"Text color"]}),e(B,{children:he.map(l=>e(M,Object.assign({onClick:()=>(e=>{r&&w&&0!==w.length&&(u.setCellTextColor(r,o,{cells:w,color:e}),g(!1))})(l.value)},{children:t("div",Object.assign({className:"flex items-center gap-2"},{children:[e("div",Object.assign({className:"h-4 w-4 rounded border flex items-center justify-center text-xs font-bold",style:{color:l.color}},{children:"A"})),l.label]}))}),l.value))})]})]}))]})]})),t("div",Object.assign({className:"space-y-1"},{children:[e(D,Object.assign({className:"text-sm font-medium"},{children:"Alignment"})),t(N,{children:[e(C,Object.assign({asChild:!0},{children:t(k,Object.assign({variant:"outline",size:"sm",className:"w-full justify-between"},{children:[t("span",Object.assign({className:"flex items-center gap-2"},{children:[e(Y,{className:"h-4 w-4"}),"Select alignment"]})),e(V,{className:"h-4 w-4 opacity-50"})]}))})),t(O,Object.assign({className:"w-56",align:"start"},{children:[t($,{children:[t(S,{children:[e(Y,{className:"mr-2 h-4 w-4"}),"Horizontal"]}),t(B,{children:[e(M,Object.assign({onClick:()=>x("left")},{children:"Left"})),e(M,Object.assign({onClick:()=>x("center")},{children:"Center"})),e(M,Object.assign({onClick:()=>x("right")},{children:"Right"})),e(M,Object.assign({onClick:()=>x("justify")},{children:"Justify"}))]})]}),t($,{children:[t(S,{children:[e(K,{className:"mr-2 h-4 w-4"}),"Vertical"]}),t(B,{children:[e(M,Object.assign({onClick:()=>j("top")},{children:"Top"})),e(M,Object.assign({onClick:()=>j("middle")},{children:"Middle"})),e(M,Object.assign({onClick:()=>j("bottom")},{children:"Bottom"}))]})]})]}))]})]})),e(G,{}),t(k,Object.assign({variant:"ghost",size:"sm",className:"w-full justify-start gap-2 text-destructive hover:text-destructive",onClick:()=>{r&&w&&0!==w.length&&(u.clearContents(r,o,{cells:w}),g(!1))}},{children:[e(J,{className:"h-4 w-4"}),"Clear contents"]}))]}))}))]}))}))]}):null};F("[data-element-type=table-data-cell] [data-slate-node=element]{margin:0}[data-slate-node=table]{-webkit-user-select:none;-moz-user-select:none;user-select:none}[data-slate-node=table-data-cell]{cursor:cell}[data-slate-node=table-data-cell]:active{cursor:crosshair}[data-is-selecting=true] ::-moz-selection{background:none}[data-is-selecting=true] ::selection{background:none}.column-resize-handle{transition:background-color .15s ease}.column-resize-handle:hover{background-color:hsl(var(--primary)/.3)!important}.yoopta-table-bordered [data-slot=table-cell]:first-child,.yoopta-table-bordered [data-slot=table-head]:first-child{border-left:1px solid hsl(var(--border))}.yoopta-table-bordered [data-slot=table-cell]:last-child,.yoopta-table-bordered [data-slot=table-head]:last-child{border-right:1px solid hsl(var(--border))}.yoopta-table-no-borders [data-slot=table-body] tr:first-child{border-top:none}.yoopta-table-no-borders [data-slot=table-body] tr:last-child{border-bottom:none}.yoopta-table-striped [data-slot=table-body] tr:nth-child(2n){background-color:hsl(var(--muted)/.4)}.yoopta-table-compact [data-slot=table-cell],.yoopta-table-compact [data-slot=table-head]{padding:4px 6px}.yoopta-table-compact [data-slot=table-head]{height:auto}.yoopta-table-scrollable table[data-slot=table]{min-width:100%}body.resizing-column{-webkit-user-select:none!important;-moz-user-select:none!important;user-select:none!important}body.resizing-column,body.resizing-column *{cursor:col-resize!important}");const pe={table:{render:o=>{var n,r,a,s,u,m,b;const{attributes:p,children:v,element:y,blockId:w}=o,x=y,k=c(),j=i(()=>d.getBlockSlate(k,{id:w}),[k,w]),N=j?h.get(j):null,C=null===(r=null===(n=x.props)||void 0===n?void 0:n.bordered)||void 0===r||r,O=null!==(s=null===(a=x.props)||void 0===a?void 0:a.compact)&&void 0!==s&&s,M=null===(m=null===(u=x.props)||void 0===u?void 0:u.scrollable)||void 0===m||m,z=null===(b=x.props)||void 0===b?void 0:b.columnWidths,E=i(()=>{if(M&&z&&0!==z.length)return z.reduce((e,t)=>e+("number"==typeof t?t:parseFloat(String(t))||0),0)},[M,z]);return t("div",Object.assign({className:f("group relative p-4",C?"yoopta-table-bordered":"yoopta-table-no-borders",O&&"yoopta-table-compact",M&&"yoopta-table-scrollable"),"data-yoopta-block-id":w,"data-table-container":!0},{children:[t(g.Root,Object.assign({blockId:w,element:y},{children:[e(g.Trigger,{className:"absolute right-0 top-0 z-10 opacity-0 group-hover:opacity-100 transition-opacity rounded-md p-1 hover:bg-accent"}),e(ue,{})]})),e("div",Object.assign({className:f(M&&"overflow-x-auto")},{children:t(ee,Object.assign({},p,{style:M&&E?{width:`${E}px`}:void 0,"data-is-selecting":!!N},{children:[e("colgroup",{children:null==z?void 0:z.map((t,l)=>e("col",{style:{width:`${t}px`}},l))}),e(te,{children:v})]}))})),!k.readOnly&&t(l,{children:[e(be,{blockId:w}),e(de,{blockId:w}),e(re,{blockId:w})]})]}))}},"table-row":{render:t=>{const{attributes:l,children:o}=t;return e(le,Object.assign({},l,{children:o}))}},"table-data-cell":{render:t=>{var l,o,n,r,a,s,u,b,p,g,v,y;const{attributes:w,children:x,element:k}=t,j=k,N=c(),C=i(()=>d.getBlockSlate(N,{id:t.blockId}),[N,t.blockId]),O=(null===(l=j.props)||void 0===l?void 0:l.asHeader)?oe:ne;return e(O,Object.assign({},w,{onMouseDown:e=>{N.readOnly||(e.stopPropagation(),C&&(m.delete(C),h.delete(C)))},colSpan:null!==(n=null===(o=j.props)||void 0===o?void 0:o.colSpan)&&void 0!==n?n:1,rowSpan:null!==(a=null===(r=j.props)||void 0===r?void 0:r.rowSpan)&&void 0!==a?a:1,align:null!==(u=null===(s=j.props)||void 0===s?void 0:s.align)&&void 0!==u?u:"left",valign:null!==(p=null===(b=j.props)||void 0===b?void 0:b.verticalAlign)&&void 0!==p?p:"middle","data-yoopta-element-id":j.id,className:f("relative group transition-colors"),style:{backgroundColor:null===(g=j.props)||void 0===g?void 0:g.backgroundColor,color:null!==(y=null===(v=j.props)||void 0===v?void 0:v.color)&&void 0!==y?y:"inherit"}},{children:x}))}}};export{pe as TableUI};
|
|
13
|
+
*/ee.displayName="Table";o((t,l)=>{var{className:o}=t,n=v(t,["className"]);return e("thead",Object.assign({ref:l,"data-slot":"table-header",className:f("[&_tr]:border-b",o)},n))}).displayName="TableHeader";const te=o((t,l)=>{var{className:o}=t,n=v(t,["className"]);return e("tbody",Object.assign({ref:l,"data-slot":"table-body",className:f("[&_tr:first-child]:border-t [&_tr]:border-b [&_tr]:border-border",o)},n))});te.displayName="TableBody";o((t,l)=>{var{className:o}=t,n=v(t,["className"]);return e("tfoot",Object.assign({ref:l,"data-slot":"table-footer",className:f("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",o)},n))}).displayName="TableFooter";const le=o((t,l)=>{var{className:o}=t,n=v(t,["className"]);return e("tr",Object.assign({ref:l,"data-slot":"table-row",className:f("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",o)},n))});le.displayName="TableRow";const oe=o((t,l)=>{var{className:o}=t,n=v(t,["className"]);return e("th",Object.assign({ref:l,"data-slot":"table-head",className:f("border-border border-r last:border-r-0 text-foreground h-10 px-2 text-left font-medium [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] bg-muted/50",o)},n))});oe.displayName="TableHead";const ne=o((t,l)=>{var{className:o}=t,n=v(t,["className"]);return e("td",Object.assign({ref:l,"data-slot":"table-cell",className:f("border-border border-r last:border-r-0 p-2 [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",o)},n))});ne.displayName="TableCell";o((t,l)=>{var{className:o}=t,n=v(t,["className"]);return e("caption",Object.assign({ref:l,"data-slot":"table-caption",className:f("text-muted-foreground mt-4 text-sm",o)},n))}).displayName="TableCaption";const re=({blockId:t})=>{const l=c(),[o,i]=n(null),[d,m]=n(!1),[h,b]=n(null),[p,g]=n([]),v=r(0),f=r(0),w=r([]),x=r(null),k=r(null),j=r(null);a(()=>{w.current=p},[p]),a(()=>{k.current=o},[o]),a(()=>{x.current=h},[h]);const N=s(()=>{const e=document.querySelector(`[data-yoopta-block-id="${t}"][data-table-container]`);if(!e)return;const l=e.querySelector("table");if(!l)return;const o=l.getBoundingClientRect();i(o);const n=l.querySelector("colgroup");j.current=n;const r=l.querySelectorAll("colgroup col"),a=l.querySelector("tr");if(r.length>0){const e=[];o.left,r.forEach((t,l)=>{const o=window.getComputedStyle(t),n=parseInt(o.width,10)||200;e.push(n)}),g(e)}else if(a){const e=a.querySelectorAll("td, th"),t=[],l=[];e.forEach((e,o)=>{const n=e.getBoundingClientRect();l.push(n.width),t.push({index:o,left:n.left,width:n.width})}),g(l)}},[t]);a(()=>{N();const e=document.querySelector(`[data-yoopta-block-id="${t}"][data-table-container]`);if(!e)return;const l=e.querySelector("table");if(!l)return;const o=new ResizeObserver(()=>{d||N()});o.observe(l);const n=new MutationObserver(()=>{d||N()});n.observe(l,{childList:!0,subtree:!0});const r=()=>{d||N()};return window.addEventListener("scroll",r,!0),()=>{o.disconnect(),n.disconnect(),window.removeEventListener("scroll",r,!0)}},[t,N,d]);const C=s(e=>{if(!j.current)return;j.current.querySelectorAll("col").forEach((t,l)=>{void 0!==e[l]&&(t.style.width=`${e[l]}px`)})},[]),O=s((e,t)=>{if(!t||0===e.length)return[];let l=t.left;return e.map((e,t)=>{const o={index:t,left:l,width:e};return l+=e,o})},[]),M=s((e,t)=>{e.preventDefault(),e.stopPropagation();const l=p[t];void 0!==l&&(m(!0),b(t),v.current=e.clientX,f.current=l,document.body.classList.add("resizing-column"))},[p]),z=s(e=>{const t=x.current;if(null===t)return;const l=e.clientX-v.current,o=Math.max(50,f.current+l),n=[...w.current];n[t]=o,g(n),C(n)},[C]),E=s(()=>{const e=x.current,o=w.current;null!==e&&void 0!==o[e]&&u.setColumnWidth(l,t,e,o[e]),m(!1),b(null),document.body.classList.remove("resizing-column"),setTimeout(N,50)},[l,t,N]);if(a(()=>{if(d)return document.addEventListener("mousemove",z),document.addEventListener("mouseup",E),()=>{document.removeEventListener("mousemove",z),document.removeEventListener("mouseup",E)}},[d,z,E]),!o||0===p.length)return null;const L=O(p,o).slice(0,-1).map(t=>{const l=t.left+t.width-3;return e("div",{className:"column-resize-handle",style:{position:"fixed",left:`${l}px`,top:`${o.top}px`,width:"6px",height:`${o.height}px`,cursor:"col-resize",zIndex:50,backgroundColor:d&&h===t.index?"hsl(var(--primary))":"transparent"},onMouseDown:e=>M(e,t.index),onMouseEnter:e=>{d||(e.target.style.backgroundColor="hsl(var(--primary) / 0.3)")},onMouseLeave:e=>{d||(e.target.style.backgroundColor="transparent")}},`resize-${t.index}`)});return e(y,Object.assign({id:"column-resize-handles-container"},{children:e("div",Object.assign({className:"column-resize-handles-container",style:{pointerEvents:d?"auto":void 0}},{children:L}))}))},ae=({blockId:t,totalColumns:l,position:o,onMouseEnter:n,onMouseLeave:r})=>{const a=c(),i=s(()=>{const e=[0,0,l-1,0];u.insertTableColumn(a,t,{path:e,insertMode:"after"})},[a,t,l]);return e(y,Object.assign({id:`table-add-column-button-${t}`},{children:e("div",Object.assign({className:"fixed z-[9999] pointer-events-auto",style:{left:`${o.left+4}px`,top:`${o.top}px`,width:"18px",height:`${o.height}px`},onMouseEnter:n,onMouseLeave:r},{children:e(k,Object.assign({variant:"ghost",size:"sm",className:"p-0 h-full w-full bg-background/95 hover:bg-accent border border-border/50 shadow-sm rounded-md transition-all hover:shadow-md flex items-center justify-center text-muted-foreground hover:text-foreground",onClick:i,onMouseDown:e=>e.preventDefault()},{children:e(j,{className:"h-3 w-3"})}))}))}))},se=({blockId:t,totalRows:l,position:o,onMouseEnter:n,onMouseLeave:r})=>{const a=c(),i=s(()=>{const e=[0,l-1,0,0];u.insertTableRow(a,t,{path:e,insertMode:"after"})},[a,t,l]);return e(y,Object.assign({id:`table-add-row-button-${t}`},{children:e("div",Object.assign({className:"fixed z-[9999] pointer-events-auto",style:{left:`${o.left}px`,top:`${o.top+4}px`,width:`${o.width}px`,height:"18px"},onMouseEnter:n,onMouseLeave:r},{children:e(k,Object.assign({variant:"ghost",size:"sm",className:"h-full w-full bg-background/95 hover:bg-accent border border-border/50 shadow-sm rounded-md transition-all hover:shadow-md flex items-center justify-center gap-1.5 text-muted-foreground hover:text-foreground",onClick:i,onMouseDown:e=>e.preventDefault()},{children:e(j,{className:"h-3 w-3"})}))}))}))},ie=({blockId:o,colIndex:n,position:r,onMouseEnter:a,onMouseLeave:d})=>{const m=c(),h=i(()=>[0,0,n,0],[n]),b=s(()=>{u.insertTableColumn(m,o,{path:h,insertMode:"before"})},[m,o,h]),p=s(()=>{u.insertTableColumn(m,o,{path:h,insertMode:"after"})},[m,o,h]),g=s(()=>{u.deleteTableColumn(m,o,{path:h})},[m,o,h]),v=s(()=>{u.toggleHeaderColumn(m,o)},[m,o]);return e(y,Object.assign({id:`table-column-controls-${o}-${n}`},{children:e("div",Object.assign({className:"fixed z-[9999] pointer-events-auto",style:{left:`${r.left}px`,top:`${r.top+4}px`,width:`${r.width}px`,height:"18px"},onMouseEnter:a,onMouseLeave:d},{children:t(N,{children:[e(C,Object.assign({asChild:!0},{children:e(k,Object.assign({variant:"ghost",size:"sm",className:"h-full w-full bg-background/95 hover:bg-accent border border-border/50 shadow-sm rounded-md p-0 transition-all hover:shadow-md",onMouseDown:e=>e.preventDefault()},{children:e(Y,{className:"h-3 w-3 text-muted-foreground"})}))})),t(O,Object.assign({align:"start",side:"top",className:"w-48"},{children:[0===n&&t(l,{children:[t(M,Object.assign({onClick:v},{children:[e(Q,{className:"mr-2 h-4 w-4"}),"Header column"]})),e(z,{})]}),t(M,Object.assign({onClick:b},{children:[e(T,{className:"mr-2 h-4 w-4"}),"Insert column left"]})),t(M,Object.assign({onClick:p},{children:[e(q,{className:"mr-2 h-4 w-4"}),"Insert column right"]})),e(z,{}),t(M,Object.assign({onClick:g,className:"text-destructive focus:text-destructive"},{children:[e(A,{className:"mr-2 h-4 w-4"}),"Delete column"]}))]}))]})}))}))},ce=({blockId:o,rowIndex:n,position:r,onMouseEnter:a,onMouseLeave:d})=>{const m=c(),h=i(()=>[0,n,0,0],[n]),b=s(()=>{u.insertTableRow(m,o,{path:h,insertMode:"before"})},[m,o,h]),p=s(()=>{u.insertTableRow(m,o,{path:h,insertMode:"after"})},[m,o,h]),g=s(()=>{u.deleteTableRow(m,o,{path:h})},[m,o,h]),v=s(()=>{u.toggleHeaderRow(m,o)},[m,o]);return e(y,Object.assign({id:`table-row-controls-${o}-${n}`},{children:e("div",Object.assign({className:"fixed z-[9998] pointer-events-auto",style:{left:`${r.left+20}px`,top:`${r.top}px`,width:"18px",height:`${r.height}px`},onMouseEnter:a,onMouseLeave:d},{children:t(N,{children:[e(C,Object.assign({asChild:!0},{children:e(k,Object.assign({variant:"ghost",size:"sm",className:"h-full w-full bg-background/95 hover:bg-accent border border-border/50 shadow-sm rounded-md p-0 transition-all hover:shadow-md flex items-center justify-center",onMouseDown:e=>e.preventDefault()},{children:e(E,{className:"h-3 w-3 text-muted-foreground"})}))})),t(O,Object.assign({align:"start",side:"left",className:"w-48"},{children:[0===n&&t(l,{children:[t(M,Object.assign({onClick:v},{children:[e(Q,{className:"mr-2 h-4 w-4"}),"Header row"]})),e(z,{})]}),t(M,Object.assign({onClick:b},{children:[e(L,{className:"mr-2 h-4 w-4"}),"Insert row above"]})),t(M,Object.assign({onClick:p},{children:[e(I,{className:"mr-2 h-4 w-4"}),"Insert row below"]})),e(z,{}),t(M,Object.assign({onClick:g,className:"text-destructive focus:text-destructive"},{children:[e(A,{className:"mr-2 h-4 w-4"}),"Delete row"]}))]}))]})}))}))},de=({blockId:o})=>{const u=c(),m=i(()=>d.getBlockSlate(u,{id:o}),[o,u]),[h,b]=n(null),[p,g]=n(!1),[v,f]=n({rowControls:null,columnControls:null,addRowButton:null,addColumnButton:null}),y=r(!1),k=r(!1),j=r(null),N=r(null);N.current=h;const C=s(()=>{var e,t;const l=N.current;if(!l)return void f({rowControls:null,columnControls:null,addRowButton:null,addColumnButton:null});const n=document.querySelector(`[data-yoopta-block-id="${o}"][data-table-container]`);if(!n)return;const r=n.querySelector(".overflow-x-auto"),a=null==r?void 0:r.getBoundingClientRect(),s=n.querySelector("table");if(!s)return;const i=s.getBoundingClientRect(),c=Array.from(n.querySelectorAll("tr")),d=c[l.rowIndex];if(!d)return;const u=Array.from(d.querySelectorAll('[data-element-type="table-data-cell"]'));if(0===u.length)return;const m=u.map(e=>e.getBoundingClientRect()),h=Math.min(...m.map(e=>e.top)),b=Math.max(...m.map(e=>e.bottom)),p=Math.min(...m.map(e=>e.left)),g=b-h,v=[];c.forEach(e=>{const t=Array.from(e.querySelectorAll('[data-element-type="table-data-cell"]'));t[l.colIndex]&&v.push(t[l.colIndex].getBoundingClientRect())});const y=v.length>0?Math.min(...v.map(e=>e.left)):p,w=v.length>0?Math.max(...v.map(e=>e.right)):p,x=w-y,k=v.length>0?Math.min(...v.map(e=>e.top)):h,j=l.rowIndex===l.totalRows-1,C=l.colIndex===l.totalColumns-1,O=!a||y>=a.left-x&&w<=a.right+x,M=null!==(e=null==a?void 0:a.left)&&void 0!==e?e:i.left,z=null!==(t=null==a?void 0:a.right)&&void 0!==t?t:i.right,E=z-M;f({rowControls:{left:Math.max(0,p-32),top:h,height:g},columnControls:O?{left:y,top:k-32,width:x}:null,addRowButton:j?{left:M,top:i.bottom,width:E}:null,addColumnButton:C?{left:Math.min(i.right,z),top:i.top,height:i.height}:null})},[o]);a(()=>{if(!h||!p)return;const e=()=>{C()};return window.addEventListener("scroll",e,!0),window.addEventListener("resize",e),C(),()=>{window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e)}},[h,p,C]);const O=s(()=>{j.current&&(clearTimeout(j.current),j.current=null)},[]),M=s(()=>{O(),j.current=setTimeout(()=>{y.current||k.current||(g(!1),b(null))},150)},[O]),z=s(e=>{if(!m)return null;const t=Array.from(w.nodes(m,{at:[0],match:t=>{if(!x.isElement(t))return!1;const l=t;return"table-data-cell"===l.type&&"id"in l&&l.id===e},mode:"all"}));if(0===t.length)return null;const[,l]=t[0],o=l[l.length-2],n=l[l.length-1],r=Array.from(w.nodes(m,{at:[0],match:e=>x.isElement(e)&&"table"===e.type,mode:"lowest"}));if(0===r.length)return null;const[a]=r[0];if(!x.isElement(a))return null;const s=a.children.length,i=a.children[0];if(!x.isElement(i))return null;const c=i.children.length;return{rowIndex:o,colIndex:n,cellElementId:e,totalRows:s,totalColumns:c}},[m]);a(()=>{const e=document.querySelector(`[data-yoopta-block-id="${o}"][data-table-container]`);if(!e||!m)return;const t=e=>{O(),y.current=!0;const t=e.target.closest('[data-element-type="table-data-cell"]');if(!t)return;const l=t.getAttribute("data-yoopta-element-id");if(!l)return;const o=N.current;if((null==o?void 0:o.cellElementId)===l)return void g(!0);const n=z(l);n&&(b(n),g(!0))},l=()=>{y.current=!1,M()};return e.addEventListener("mousemove",t),e.addEventListener("mouseleave",l),()=>{O(),e.removeEventListener("mousemove",t),e.removeEventListener("mouseleave",l)}},[o,m,z,O,M]);const E=s(()=>{O(),k.current=!0},[O]),L=s(()=>{k.current=!1,M()},[M]);return p&&h?t(l,{children:[v.rowControls&&e(ce,{blockId:o,rowIndex:h.rowIndex,position:v.rowControls,onMouseEnter:E,onMouseLeave:L}),v.columnControls&&e(ie,{blockId:o,colIndex:h.colIndex,position:v.columnControls,onMouseEnter:E,onMouseLeave:L}),v.addColumnButton&&e(ae,{blockId:o,totalColumns:h.totalColumns,position:v.addColumnButton,onMouseEnter:E,onMouseLeave:L}),v.addRowButton&&e(se,{blockId:o,totalRows:h.totalRows,position:v.addRowButton,onMouseEnter:E,onMouseLeave:L})]}):null},ue=()=>{var l,o,n,r;const{element:a}=b(),s=p(),i=null!==(l=a.props)&&void 0!==l?l:{};return e(g.Content,Object.assign({side:"bottom",align:"end",sideOffset:8,className:"min-w-[180px] rounded-lg border bg-popover p-2 shadow-md"},{children:t(g.Group,Object.assign({className:"flex flex-col gap-1.5"},{children:[e(g.Label,Object.assign({className:"px-2 text-xs font-bold text-muted-foreground"},{children:"Appearance"})),t("div",Object.assign({className:"flex items-center justify-between px-2"},{children:[e("span",Object.assign({className:"text-xs font-medium text-muted-foreground"},{children:"Bordered"})),e(g.Toggle,{checked:null===(o=i.bordered)||void 0===o||o,onCheckedChange:e=>s({bordered:e})})]})),t("div",Object.assign({className:"flex items-center justify-between px-2"},{children:[e("span",Object.assign({className:"text-xs font-medium text-muted-foreground"},{children:"Compact"})),e(g.Toggle,{checked:null!==(n=i.compact)&&void 0!==n&&n,onCheckedChange:e=>s({compact:e})})]})),t("div",Object.assign({className:"flex items-center justify-between px-2"},{children:[e("span",Object.assign({className:"text-xs font-medium text-muted-foreground"},{children:"Scrollable"})),e(g.Toggle,{checked:null===(r=i.scrollable)||void 0===r||r,onCheckedChange:e=>s({scrollable:e})})]}))]}))}))},me=[{label:"None",value:"transparent",color:"transparent"},{label:"Gray",value:"hsl(var(--muted))",color:"hsl(var(--muted))"},{label:"Red",value:"hsl(0 70% 95%)",color:"hsl(0 70% 95%)"},{label:"Orange",value:"hsl(30 70% 95%)",color:"hsl(30 70% 95%)"},{label:"Yellow",value:"hsl(60 70% 95%)",color:"hsl(60 70% 95%)"},{label:"Green",value:"hsl(120 70% 95%)",color:"hsl(120 70% 95%)"},{label:"Blue",value:"hsl(210 70% 95%)",color:"hsl(210 70% 95%)"},{label:"Purple",value:"hsl(270 70% 95%)",color:"hsl(270 70% 95%)"}],he=[{label:"Default",value:"inherit",color:"currentColor"},{label:"Gray",value:"hsl(var(--muted-foreground))",color:"hsl(var(--muted-foreground))"},{label:"Red",value:"hsl(0 70% 50%)",color:"hsl(0 70% 50%)"},{label:"Orange",value:"hsl(30 70% 50%)",color:"hsl(30 70% 50%)"},{label:"Yellow",value:"hsl(60 70% 40%)",color:"hsl(60 70% 40%)"},{label:"Green",value:"hsl(120 70% 40%)",color:"hsl(120 70% 40%)"},{label:"Blue",value:"hsl(210 70% 50%)",color:"hsl(210 70% 50%)"},{label:"Purple",value:"hsl(270 70% 50%)",color:"hsl(270 70% 50%)"}],be=({blockId:o})=>{const r=c(),s=i(()=>d.getBlockSlate(r,{id:o}),[o,r]),[h,b]=n(null),[p,g]=n(!1),[v,f]=n([]),y=s?m.get(s):[];a(()=>{f(y)},[y]);const w=Array.isArray(y)&&(null==y?void 0:y.length)>0?y:v;a(()=>{if(!s||!w||w.length<=1)return void b(null);const e=document.querySelector(`[data-yoopta-block-id="${o}"]`);if(!e)return void b(null);const t=e.getBoundingClientRect();let l=1/0,n=-1/0,r=1/0,a=-1/0;for(const[e]of w){const t=document.querySelector(`[data-yoopta-block-id="${o}"] [data-yoopta-element-id="${e.id}"]`);if(!t)continue;const s=t.getBoundingClientRect();if(!s)continue;const{top:i,bottom:c,left:d,right:u}=s;l=Math.min(l,i),n=Math.max(n,c),r=Math.min(r,d),a=Math.max(a,u)}b(l!==1/0?{top:l-t.top,left:r-t.left,width:a-r,height:n-l}:null)},[s,w,o]),a(()=>{if(!w||w.length<=1)return;const e=()=>{b(e=>e?Object.assign({},e):null)};return window.addEventListener("scroll",e,!0),window.addEventListener("resize",e),()=>{window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e)}},[w]);const x=e=>{r&&w&&0!==w.length&&(u.setCellHorizontalAlign(r,o,{cells:w,align:e}),g(!1))},j=e=>{r&&w&&0!==w.length&&(u.setCellVerticalAlign(r,o,{cells:w,align:e}),g(!1))};return h?t(l,{children:[e("div",{className:"pointer-events-none absolute z-[9999]",style:{top:`${h.top}px`,left:`${h.left}px`,width:`${h.width}px`,height:`${h.height}px`,border:"2px solid hsl(var(--primary))",backgroundColor:"hsl(var(--primary) / 0.05)",borderRadius:"2px"}}),e("div",Object.assign({className:"absolute z-20 pointer-events-auto",style:{top:`${h.top+h.height/2}px`,left:`${h.left+h.width}px`,transform:"translate(-50%, -50%)"}},{children:t(H,Object.assign({open:p,onOpenChange:g},{children:[e(P,Object.assign({asChild:!0},{children:e(k,Object.assign({variant:"secondary",size:"icon",className:"h-4 w-4 rounded-full shadow-lg bg-primary hover:bg-primary/90",onMouseDown:e=>e.preventDefault()},{children:e(E,{className:"h-3 w-3 text-primary-foreground"})}))})),e(G,Object.assign({className:"w-64 p-2",align:"start",side:"right"},{children:t("div",Object.assign({className:"space-y-2"},{children:[t(k,Object.assign({variant:"ghost",size:"sm",className:"w-full justify-start gap-2",onClick:()=>{!r||!w||w.length<=1||(u.mergeCells(r,o,{cells:w}),g(!1))},disabled:!w||w.length<=1},{children:[e(X,{className:"h-4 w-4"}),"Merge cells"]})),e(_,{}),t("div",Object.assign({className:"space-y-1"},{children:[e(D,Object.assign({className:"text-sm font-medium"},{children:"Color"})),t(N,{children:[e(C,Object.assign({asChild:!0},{children:t(k,Object.assign({variant:"outline",size:"sm",className:"w-full justify-between"},{children:[t("span",Object.assign({className:"flex items-center gap-2"},{children:[e(Z,{className:"h-4 w-4"}),"Select color"]})),e(V,{className:"h-4 w-4 opacity-50"})]}))})),t(O,Object.assign({className:"w-56",align:"start"},{children:[t($,{children:[t(S,{children:[e(Z,{className:"mr-2 h-4 w-4"}),"Background color"]}),e(B,{children:me.map(l=>e(M,Object.assign({onClick:()=>(e=>{r&&w&&0!==w.length&&(u.setCellBackgroundColor(r,o,{cells:w,color:e}),g(!1))})(l.value)},{children:t("div",Object.assign({className:"flex items-center gap-2"},{children:[e("div",{className:"h-4 w-4 rounded border",style:{backgroundColor:l.color}}),l.label]}))}),l.value))})]}),t($,{children:[t(S,{children:[e(U,{className:"mr-2 h-4 w-4"}),"Text color"]}),e(B,{children:he.map(l=>e(M,Object.assign({onClick:()=>(e=>{r&&w&&0!==w.length&&(u.setCellTextColor(r,o,{cells:w,color:e}),g(!1))})(l.value)},{children:t("div",Object.assign({className:"flex items-center gap-2"},{children:[e("div",Object.assign({className:"h-4 w-4 rounded border flex items-center justify-center text-xs font-bold",style:{color:l.color}},{children:"A"})),l.label]}))}),l.value))})]})]}))]})]})),t("div",Object.assign({className:"space-y-1"},{children:[e(D,Object.assign({className:"text-sm font-medium"},{children:"Alignment"})),t(N,{children:[e(C,Object.assign({asChild:!0},{children:t(k,Object.assign({variant:"outline",size:"sm",className:"w-full justify-between"},{children:[t("span",Object.assign({className:"flex items-center gap-2"},{children:[e(J,{className:"h-4 w-4"}),"Select alignment"]})),e(V,{className:"h-4 w-4 opacity-50"})]}))})),t(O,Object.assign({className:"w-56",align:"start"},{children:[t($,{children:[t(S,{children:[e(J,{className:"mr-2 h-4 w-4"}),"Horizontal"]}),t(B,{children:[e(M,Object.assign({onClick:()=>x("left")},{children:"Left"})),e(M,Object.assign({onClick:()=>x("center")},{children:"Center"})),e(M,Object.assign({onClick:()=>x("right")},{children:"Right"})),e(M,Object.assign({onClick:()=>x("justify")},{children:"Justify"}))]})]}),t($,{children:[t(S,{children:[e(K,{className:"mr-2 h-4 w-4"}),"Vertical"]}),t(B,{children:[e(M,Object.assign({onClick:()=>j("top")},{children:"Top"})),e(M,Object.assign({onClick:()=>j("middle")},{children:"Middle"})),e(M,Object.assign({onClick:()=>j("bottom")},{children:"Bottom"}))]})]})]}))]})]})),e(_,{}),t(k,Object.assign({variant:"ghost",size:"sm",className:"w-full justify-start gap-2 text-destructive hover:text-destructive",onClick:()=>{r&&w&&0!==w.length&&(u.clearContents(r,o,{cells:w}),g(!1))}},{children:[e(W,{className:"h-4 w-4"}),"Clear contents"]}))]}))}))]}))}))]}):null};F("[data-element-type=table-data-cell] [data-slate-node=element]{margin:0}[data-slate-node=table]{-webkit-user-select:none;-moz-user-select:none;user-select:none}[data-slate-node=table-data-cell]{cursor:cell}[data-slate-node=table-data-cell]:active{cursor:crosshair}[data-is-selecting=true] ::-moz-selection{background:none}[data-is-selecting=true] ::selection{background:none}.column-resize-handle{transition:background-color .15s ease}.column-resize-handle:hover{background-color:hsl(var(--primary)/.3)!important}.yoopta-table-bordered [data-slot=table-cell]:first-child,.yoopta-table-bordered [data-slot=table-head]:first-child{border-left:1px solid hsl(var(--border))}.yoopta-table-bordered [data-slot=table-cell]:last-child,.yoopta-table-bordered [data-slot=table-head]:last-child{border-right:1px solid hsl(var(--border))}.yoopta-table-no-borders [data-slot=table-body] tr:first-child{border-top:none}.yoopta-table-no-borders [data-slot=table-body] tr:last-child{border-bottom:none}.yoopta-table-striped [data-slot=table-body] tr:nth-child(2n){background-color:hsl(var(--muted)/.4)}.yoopta-table-compact [data-slot=table-cell],.yoopta-table-compact [data-slot=table-head]{padding:4px 6px}.yoopta-table-compact [data-slot=table-head]{height:auto}.yoopta-table-scrollable table[data-slot=table]{min-width:100%}body.resizing-column{-webkit-user-select:none!important;-moz-user-select:none!important;user-select:none!important}body.resizing-column,body.resizing-column *{cursor:col-resize!important}");const pe={table:{render:o=>{var n,r,a,s,u,m,b;const{attributes:p,children:v,element:y,blockId:w}=o,x=y,k=c(),j=i(()=>d.getBlockSlate(k,{id:w}),[k,w]),N=j?h.get(j):null,C=null===(r=null===(n=x.props)||void 0===n?void 0:n.bordered)||void 0===r||r,O=null!==(s=null===(a=x.props)||void 0===a?void 0:a.compact)&&void 0!==s&&s,M=null===(m=null===(u=x.props)||void 0===u?void 0:u.scrollable)||void 0===m||m,z=null===(b=x.props)||void 0===b?void 0:b.columnWidths,E=i(()=>{if(M&&z&&0!==z.length)return z.reduce((e,t)=>e+("number"==typeof t?t:parseFloat(String(t))||0),0)},[M,z]);return t("div",Object.assign({className:f("group relative p-4",C?"yoopta-table-bordered":"yoopta-table-no-borders",O&&"yoopta-table-compact",M&&"yoopta-table-scrollable"),"data-yoopta-block-id":w,"data-table-container":!0},{children:[t(g.Root,Object.assign({blockId:w,element:y},{children:[e(g.Trigger,{className:"absolute right-0 top-0 z-10 opacity-0 group-hover:opacity-100 transition-opacity rounded-md p-1 hover:bg-accent"}),e(ue,{})]})),e("div",Object.assign({className:f(M&&"overflow-x-auto")},{children:t(ee,Object.assign({},p,{style:M&&E?{width:`${E}px`}:void 0,"data-is-selecting":!!N},{children:[e("colgroup",{children:null==z?void 0:z.map((t,l)=>e("col",{style:{width:`${t}px`}},l))}),e(te,{children:v})]}))})),!k.readOnly&&t(l,{children:[e(be,{blockId:w}),e(de,{blockId:w}),e(re,{blockId:w})]})]}))}},"table-row":{render:t=>{const{attributes:l,children:o}=t;return e(le,Object.assign({},l,{children:o}))}},"table-data-cell":{render:t=>{var l,o,n,r,a,s,u,b,p,g,v,y;const{attributes:w,children:x,element:k}=t,j=k,N=c(),C=i(()=>d.getBlockSlate(N,{id:t.blockId}),[N,t.blockId]),O=(null===(l=j.props)||void 0===l?void 0:l.asHeader)?oe:ne;return e(O,Object.assign({},w,{onMouseDown:e=>{N.readOnly||(e.stopPropagation(),C&&(m.delete(C),h.delete(C)))},colSpan:null!==(n=null===(o=j.props)||void 0===o?void 0:o.colSpan)&&void 0!==n?n:1,rowSpan:null!==(a=null===(r=j.props)||void 0===r?void 0:r.rowSpan)&&void 0!==a?a:1,align:null!==(u=null===(s=j.props)||void 0===s?void 0:s.align)&&void 0!==u?u:"left",valign:null!==(p=null===(b=j.props)||void 0===b?void 0:b.verticalAlign)&&void 0!==p?p:"middle","data-yoopta-element-id":j.id,className:f("relative group transition-colors"),style:{backgroundColor:null===(g=j.props)||void 0===g?void 0:g.backgroundColor,color:null!==(y=null===(v=j.props)||void 0===v?void 0:v.color)&&void 0!==y?y:"inherit"}},{children:x}))}}};export{pe as TableUI};
|
package/dist/tabs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t}from"react/jsx-runtime";import{useYooptaEditor as s,Blocks as n}from"@yoopta/editor";import{Transforms as i,Element as r}from"slate";import{T as o,a,b as c,c as l}from"./chunks/tabs-
|
|
1
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import{useYooptaEditor as s,Blocks as n}from"@yoopta/editor";import{Transforms as i,Element as r}from"slate";import{T as o,a,b as c,c as l}from"./chunks/tabs-370c3f2c.js";import{TabsCommands as d}from"@yoopta/tabs";import{X as u}from"./chunks/x-9bfeb90f.js";import{S as m,a as p}from"./chunks/scroll-area-8321348a.js";import{P as b}from"./chunks/plus-840fe920.js";import"./chunks/_tslib-35bb891d.js";import"react";import"./chunks/index-17323747.js";import"react-dom";import"./chunks/index-91a5b8d5.js";import"./chunks/index-a77c7d53.js";import"./chunks/index-5b487f4e.js";import"./chunks/index-ce60ba41.js";import"./chunks/index-70f4e709.js";import"./chunks/index-ff0e3962.js";import"./chunks/index-13505606.js";import"./chunks/index-bd6363d4.js";import"./chunks/utils-3345eade.js";import"./chunks/createLucideIcon-8605f860.js";import"./chunks/index-056e5c06.js";const h={"tabs-container":{render:t=>{var a;const{attributes:c,children:l,blockId:d,element:u}=t,m=s();return e(o,Object.assign({},c,{value:null===(a=u.props)||void 0===a?void 0:a.activeTabId,onValueChange:e=>{const t=n.getBlockSlate(m,{id:d});t&&i.setNodes(t,{props:Object.assign(Object.assign({},u.props),{activeTabId:e})},{at:[0],match:e=>r.isElement(e)&&"tabs-container"===e.type})},className:"w-full"},{children:l}))}},"tabs-list":{render:n=>{const{attributes:i,children:r,blockId:o}=n,a=s();return t(m,Object.assign({className:"w-full"},{children:[t(l,Object.assign({},i,{className:"w-full mt-2 relative justify-start"},{children:[r,!a.readOnly&&e("button",Object.assign({type:"button",contentEditable:!1,onClick:e=>{e.preventDefault(),e.stopPropagation(),d.addTabItem(a,o)},className:"ml-1 flex items-center justify-center rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 p-1.5",title:"Add tab"},{children:e(b,{className:"h-4 w-4 shrink-0 text-muted-foreground"})}))]})),e(p,{orientation:"horizontal"})]}))}},"tabs-item-heading":{render:n=>{const{attributes:i,children:r,element:o,blockId:a}=n,l=s();return t(c,Object.assign({},i,{value:o.id,className:"relative group/tab flex items-center gap-2 pr-8 whitespace-nowrap"},{children:[e("div",Object.assign({className:"flex-1 min-w-0"},{children:r})),!l.readOnly&&e("span",Object.assign({contentEditable:!1,onClick:()=>{l.readOnly||d.deleteTabItem(l,a,{tabId:o.id})},className:"absolute right-1 flex items-center justify-center rounded-sm opacity-0 group-hover/tab:opacity-100 transition-opacity hover:bg-muted focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 p-1",title:"Close tab"},{children:e(u,{className:"h-3 w-3 shrink-0 text-muted-foreground"})}))]}))}},"tabs-item-content":{render:t=>{var s;const{attributes:n,children:i,element:r}=t;return e(a,Object.assign({},n,{value:null===(s=r.props)||void 0===s?void 0:s.referenceId,className:"mt-2"},{children:i}))}}};export{h as TabsUI};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type PluginElementRenderProps } from '@yoopta/editor';
|
|
2
|
-
export declare const VideoElement: ({ element, attributes, children, blockId, }: PluginElementRenderProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const VideoElement: ({ element, attributes, children, blockId, }: PluginElementRenderProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
3
3
|
//# sourceMappingURL=video-element.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"video-element.d.ts","sourceRoot":"","sources":["../../../../src/video/elements/video/video-element.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,wBAAwB,EAA0B,MAAM,gBAAgB,CAAC;AAmBvF,eAAO,MAAM,YAAY,gDAKtB,wBAAwB,
|
|
1
|
+
{"version":3,"file":"video-element.d.ts","sourceRoot":"","sources":["../../../../src/video/elements/video/video-element.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,wBAAwB,EAA0B,MAAM,gBAAgB,CAAC;AAmBvF,eAAO,MAAM,YAAY,gDAKtB,wBAAwB,mDAgI1B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"video-inline-toolbar.d.ts","sourceRoot":"","sources":["../../../../src/video/elements/video/video-inline-toolbar.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"video-inline-toolbar.d.ts","sourceRoot":"","sources":["../../../../src/video/elements/video/video-inline-toolbar.tsx"],"names":[],"mappings":";AAWA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,KAAK,uBAAuB,GAAG;IAC7B,YAAY,EAAE,KAAK,CAAC,gBAAgB,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IACzD,YAAY,EAAE,iBAAiB,CAAC;IAChC,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IACtD,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,kBAAkB,uFAQ5B,uBAAuB,mDA0MzB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"video-render.d.ts","sourceRoot":"","sources":["../../../../src/video/elements/video/video-render.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAE/D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAMxD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,KAAK,KAAK,GAAG;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IACtD,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,UAAU,EAAE,wBAAwB,CAAC,YAAY,CAAC,CAAC;IACnD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,YAAY,EAAE,iBAAiB,CAAC;IAChC,aAAa,CAAC,EAAE,kBAAkB,CAAC;CACpC,CAAC;AAEF,eAAO,MAAM,WAAW,mGASrB,KAAK,
|
|
1
|
+
{"version":3,"file":"video-render.d.ts","sourceRoot":"","sources":["../../../../src/video/elements/video/video-render.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAE/D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAMxD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,KAAK,KAAK,GAAG;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IACtD,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,UAAU,EAAE,wBAAwB,CAAC,YAAY,CAAC,CAAC;IACnD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,YAAY,EAAE,iBAAiB,CAAC;IAChC,aAAa,CAAC,EAAE,kBAAkB,CAAC;CACpC,CAAC;AAEF,eAAO,MAAM,WAAW,mGASrB,KAAK,4CA6PP,CAAC"}
|
package/dist/video/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const VideoUI: {
|
|
2
2
|
video: {
|
|
3
|
-
render: ({ element, attributes, children, blockId, }: import("@yoopta/editor/dist/plugins/types").PluginElementExtendRenderProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
render: ({ element, attributes, children, blockId, }: import("@yoopta/editor/dist/plugins/types").PluginElementExtendRenderProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
4
4
|
};
|
|
5
5
|
};
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/video.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{_ as e,a as
|
|
1
|
+
import{_ as e,a as i}from"./chunks/_tslib-35bb891d.js";import{jsxs as t,jsx as s,Fragment as n}from"react/jsx-runtime";import*as a from"react";import{useRef as r,useState as l,useLayoutEffect as o,useEffect as c,useCallback as d}from"react";import{useYooptaEditor as h,useElementSelected as m,useBlockSelected as u,useYooptaPluginOptions as p,Elements as g,Blocks as b}from"@yoopta/editor";import{parseVideoUrl as v,getEmbedUrl as f,useVideoUpload as j,useVideoDelete as x,useVideoPreview as w,buildVideoProvider as y}from"@yoopta/video";import{Editor as N,Element as O}from"slate";import{B as k}from"./chunks/button-f335deaa.js";import{I as C}from"./chunks/input-b2431223.js";import{T as z,c as I,b as E,a as R}from"./chunks/tabs-370c3f2c.js";import{c as U}from"./chunks/utils-3345eade.js";import{L as P,U as S,D}from"./chunks/upload-b1dd210d.js";import{L,A as H,a as F,b as W,R as _}from"./chunks/index-87b75648.js";import{c as V}from"./chunks/createLucideIcon-8605f860.js";import{P as A}from"./chunks/play-998f23d2.js";import{T as B,a as q,b as M,c as T,u as $,F as Y,R as K}from"./chunks/tooltip-5defff1d.js";import{C as G,c as J}from"./chunks/index-0bca29df.js";import{L as X}from"./chunks/label-35a74462.js";import{P as Z,a as Q,b as ee}from"./chunks/popover-dae0ce5f.js";import{u as ie,S as te,a as se,b as ne,c as ae,e as re,d as le}from"./chunks/select-a3724728.js";import{S as oe}from"./chunks/separator-f4e74aca.js";import{c as ce,P as de,a as he}from"./chunks/index-17323747.js";import{u as me}from"./chunks/index-91a5b8d5.js";import{u as ue}from"./chunks/index-ff0e3962.js";import{e as pe,o as ge,f as be,s as ve,b as fe}from"./chunks/index-371259c9.js";import{S as je}from"./chunks/settings-2-84fe63d9.js";import{E as xe}from"./chunks/external-link-1579dd7f.js";import{T as we}from"./chunks/trash-2-f36597ff.js";import"./chunks/index-a77c7d53.js";import"./chunks/index-5b487f4e.js";import"./chunks/index-ce60ba41.js";import"./chunks/index-70f4e709.js";import"./chunks/index-13505606.js";import"./chunks/index-bd6363d4.js";import"react-dom";import"./chunks/index-1674c2c8.js";import"./chunks/index-a5cba5f7.js";import"./chunks/Combination-575d4475.js";import"./chunks/index-056e5c06.js";import"./chunks/chevron-down-28dfb290.js";import"./chunks/check-06bd6a78.js";import"./chunks/chevron-up-9a13532e.js";
|
|
2
2
|
/**
|
|
3
3
|
* @license lucide-react v0.294.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
|
-
*/const ye=V("Video",[["path",{d:"m22 8-6 4 6 4V8Z",key:"50v9me"}],["rect",{width:"14",height:"12",x:"2",y:"6",rx:"2",ry:"2",key:"1rqjg6"}]]),Ne=({preview:e})=>s("div",Object.assign({className:"absolute inset-0 overflow-hidden flex items-center justify-center bg-black/5"},{children:s("video",{src:e.url,className:"max-w-full max-h-full object-contain",style:{maxWidth:e.width||"100%",maxHeight:e.height||"100%"},controls:!1,muted:!0,draggable:!1})})),Oe=({progress:e})=>s("div",Object.assign({className:"absolute inset-0 z-20 flex flex-col items-center justify-center gap-4 bg-black/70 backdrop-blur-sm p-6"},{children:s("div",Object.assign({className:"w-full max-w-md space-y-4"},{children:i("div",Object.assign({className:"space-y-2"},{children:[i("div",Object.assign({className:"flex items-center justify-between text-sm"},{children:[s("span",Object.assign({className:"font-medium text-white"},{children:"Uploading video..."})),i("span",Object.assign({className:"text-white/80"},{children:[e.percentage,"%"]}))]})),s("div",Object.assign({className:"h-2 w-full overflow-hidden rounded-full bg-white/20"},{children:s("div",{className:"h-full bg-primary transition-all duration-300 ease-out",style:{width:`${e.percentage}%`}})})),i("div",Object.assign({className:"flex items-center justify-between text-xs text-white/60"},{children:[i("span",{children:[(e.loaded/1024/1024).toFixed(2)," MB /"," ",(e.total/1024/1024).toFixed(2)," MB"]}),s(S,{className:"h-3.5 w-3.5 animate-spin"})]}))]}))}))})),ke=({onUpload:e,hasPreview:t})=>{const n=r(null);return i("div",t?Object.assign({className:"flex flex-col items-center justify-center gap-4 py-8"},{children:[i("div",Object.assign({className:"text-center space-y-2"},{children:[s("p",Object.assign({className:"text-sm font-medium text-white"},{children:"Video preview"})),s("p",Object.assign({className:"text-xs text-white/80"},{children:"Uploading your video..."}))]})),s("input",{ref:n,type:"file",accept:"video/*",onChange:e,className:"hidden"})]}):Object.assign({className:"flex flex-col items-center gap-3 py-6"},{children:[s("div",Object.assign({className:"rounded-lg bg-muted p-3"},{children:s(ye,{className:"h-6 w-6 text-muted-foreground"})})),i("div",Object.assign({className:"text-center"},{children:[s("p",Object.assign({className:"text-sm font-medium"},{children:"Upload a video"})),s("p",Object.assign({className:"text-xs text-muted-foreground"},{children:"Click or drag and drop"}))]})),s(k,Object.assign({onClick:()=>{var e;return null===(e=n.current)||void 0===e?void 0:e.click()}},{children:"Choose file"})),s("input",{ref:n,type:"file",accept:"video/*",onChange:e,className:"hidden"})]}))},Ce=({onInsertUrl:e})=>{const[t,n]=l(""),[a,r]=l(!1),[o,c]=l(null),d=()=>{t.trim()&&(e(t.trim()),n(""),r(!1),c(null))};return i("div",Object.assign({className:"mt-4 space-y-3"},{children:[i("div",Object.assign({className:"space-y-2"},{children:[s(C,{placeholder:"Paste video URL (YouTube, Vimeo, Dailymotion, Loom, Wistia)...",value:t,onChange:e=>(e=>{if(n(e),e.trim()){const t=v(e.trim());r(t.isValid),c(t.provider?t.provider.charAt(0).toUpperCase()+t.provider.slice(1):null)}else r(!1),c(null)})(e.target.value),onKeyDown:e=>{"Enter"===e.key&&t.trim()&&a&&d()}}),t.trim()&&s("div",Object.assign({className:"text-xs text-muted-foreground"},{children:a?i("span",Object.assign({className:"flex items-center gap-1.5 text-green-600 dark:text-green-400"},{children:[s(A,{className:"h-3 w-3"}),o," video detected"]})):s("span",Object.assign({className:"text-destructive"},{children:"Invalid video URL. Supported: YouTube, Vimeo, Dailymotion, Loom, Wistia"}))}))]})),s(k,Object.assign({className:"w-full",onClick:d,disabled:!t.trim()||!a},{children:a?`Embed ${o} video`:"Embed video"}))]}))},ze=({onUpload:e,onInsertUrl:t,hasPreview:n})=>s("div",Object.assign({className:U("relative p-4",n&&"min-h-[300px] flex flex-col")},{children:i(z,Object.assign({defaultValue:"upload",className:"w-full"},{children:[i(I,Object.assign({className:U("grid w-full grid-cols-2",n&&"bg-background/80 backdrop-blur-sm")},{children:[i(E,Object.assign({value:"upload",className:"gap-1.5"},{children:[s(P,{className:"h-3.5 w-3.5"}),"Upload"]})),i(E,Object.assign({value:"link",className:"gap-1.5"},{children:[s(H,{className:"h-3.5 w-3.5"}),"Link"]}))]})),s(R,Object.assign({value:"upload",className:"mt-4"},{children:s(ke,{onUpload:e,hasPreview:n})})),s(R,Object.assign({value:"link"},{children:s(Ce,{onInsertUrl:t})}))]}))})),Ie=({onUpload:e,onInsertUrl:t,className:n,attributes:a,children:r,preview:l,progress:o,loading:c})=>{const d=null!==l&&!!l.url,h=c&&o;return i("div",Object.assign({className:U("mt-2 relative rounded-lg border bg-background overflow-hidden",d&&"min-h-[300px]",n)},a,{contentEditable:!1},{children:[d&&s(Ne,{preview:l}),!d&&s(ze,{onUpload:e,onInsertUrl:t,hasPreview:d}),h&&o&&s(Oe,{progress:o}),r]}))};var Ee="Switch",[Re,Ue]=ce(Ee),[Se,Pe]=Re(Ee),De=a.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:l,defaultChecked:o,required:c,disabled:d,value:h="on",onCheckedChange:m,form:u,...p}=e,[g,b]=a.useState(null),v=me(t,e=>b(e)),f=a.useRef(!1),j=!g||(u||!!g.closest("form")),[x,w]=ue({prop:l,defaultProp:o??!1,onChange:m,caller:Ee});return i(Se,{scope:n,checked:x,disabled:d,children:[s(de.button,{type:"button",role:"switch","aria-checked":x,"aria-required":c,"data-state":Fe(x),"data-disabled":d?"":void 0,disabled:d,value:h,...p,ref:v,onClick:he(e.onClick,e=>{w(e=>!e),j&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})}),j&&s(We,{control:g,bubbles:!f.current,name:r,value:h,checked:x,required:c,disabled:d,form:u,style:{transform:"translateX(-100%)"}})]})});De.displayName=Ee;var He="SwitchThumb",Le=a.forwardRef((e,t)=>{const{__scopeSwitch:i,...n}=e,a=Pe(He,i);return s(de.span,{"data-state":Fe(a.checked),"data-disabled":a.disabled?"":void 0,...n,ref:t})});Le.displayName=He;var We=a.forwardRef(({__scopeSwitch:e,control:t,checked:i,bubbles:n=!0,...r},l)=>{const o=a.useRef(null),c=me(o,l),d=te(i),h=pe(t);return a.useEffect(()=>{const e=o.current;if(!e)return;const t=window.HTMLInputElement.prototype,s=Object.getOwnPropertyDescriptor(t,"checked").set;if(d!==i&&s){const t=new Event("click",{bubbles:n});s.call(e,i),e.dispatchEvent(t)}},[d,i,n]),s("input",{type:"checkbox","aria-hidden":!0,defaultChecked:i,...r,tabIndex:-1,ref:c,style:{...r.style,...h,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function Fe(e){return e?"checked":"unchecked"}We.displayName="SwitchBubbleInput";var Me=De,Ve=Le;const Ae=a.forwardRef((t,i)=>{var{className:n}=t,a=e(t,["className"]);return s(Me,Object.assign({className:U("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",n)},a,{ref:i},{children:s(Ve,{className:U("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}))});Ae.displayName=Me.displayName;const Be={contain:{label:"Contain",description:"Fit within bounds"},cover:{label:"Cover",description:"Fill and crop"},fill:{label:"Fill",description:"Stretch to fit"}},_e=({fit:e,settings:t,onUpdate:n})=>{var a,r,o,c,d,h,m,u,p,g,b,v;const[f,j]=l(!1),x=e=>{n({settings:Object.assign(Object.assign({},t),e)})};return i(Z,Object.assign({open:f,onOpenChange:j},{children:[s(B,{children:i(_,{children:[s(T,Object.assign({asChild:!0},{children:s(Q,Object.assign({asChild:!0},{children:s(k,Object.assign({variant:f?"secondary":"ghost",size:"icon",className:"h-7 w-7"},{children:s(je,{className:"h-4 w-4"})}))}))})),s(q,{children:"Settings"})]})}),s(ee,Object.assign({className:"w-80 p-3",align:"start",contentEditable:!1,onMouseDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation()},{children:i("div",Object.assign({className:"space-y-3"},{children:[i("div",{children:[s("h4",Object.assign({className:"font-semibold"},{children:"Video settings"})),s("p",Object.assign({className:"text-xs text-muted-foreground"},{children:"Customize video playback and display"}))]}),s(oe,{}),i("div",Object.assign({className:"space-y-1"},{children:[s(X,Object.assign({htmlFor:"object-fit",className:"text-sm font-medium"},{children:"How video fits"})),i(ie,Object.assign({value:e||"contain",onValueChange:e=>n({fit:e})},{children:[s(se,Object.assign({id:"object-fit",className:"h-9 w-full"},{children:s(ne,Object.assign({placeholder:"Select how video fits"},{children:i("div",Object.assign({className:"flex items-center gap-2"},{children:[s("div",Object.assign({className:"font-medium"},{children:null===(a=Be[e||"contain"])||void 0===a?void 0:a.label})),s("div",Object.assign({className:"text-xs text-muted-foreground"},{children:null===(r=Be[e||"contain"])||void 0===r?void 0:r.description}))]}))}))})),s(ae,{children:i(re,{children:[s(le,Object.assign({value:"contain",className:"cursor-pointer"},{children:i("div",Object.assign({className:"flex items-center gap-2"},{children:[s("div",Object.assign({className:"flex h-8 w-8 shrink-0 items-center justify-center rounded border"},{children:s("div",{className:"h-4 w-3 rounded bg-primary"})})),i("div",Object.assign({className:"flex-1"},{children:[s("div",Object.assign({className:"font-medium"},{children:null===(o=Be.contain)||void 0===o?void 0:o.label})),s("div",Object.assign({className:"text-xs text-muted-foreground"},{children:null===(c=Be.contain)||void 0===c?void 0:c.description}))]}))]}))})),s(le,Object.assign({value:"cover",className:"cursor-pointer"},{children:i("div",Object.assign({className:"flex items-center gap-2"},{children:[s("div",Object.assign({className:"flex h-8 w-8 shrink-0 items-center justify-center rounded border"},{children:s("div",{className:"h-8 w-6 rounded bg-primary"})})),i("div",Object.assign({className:"flex-1"},{children:[s("div",Object.assign({className:"font-medium"},{children:null===(d=Be.cover)||void 0===d?void 0:d.label})),s("div",Object.assign({className:"text-xs text-muted-foreground"},{children:null===(h=Be.cover)||void 0===h?void 0:h.description}))]}))]}))})),s(le,Object.assign({value:"fill",className:"cursor-pointer"},{children:i("div",Object.assign({className:"flex items-center gap-2"},{children:[s("div",Object.assign({className:"flex h-8 w-8 shrink-0 items-center justify-center rounded border"},{children:s("div",{className:"h-8 w-8 rounded bg-primary"})})),i("div",Object.assign({className:"flex-1"},{children:[s("div",Object.assign({className:"font-medium"},{children:null===(m=Be.fill)||void 0===m?void 0:m.label})),s("div",Object.assign({className:"text-xs text-muted-foreground"},{children:null===(u=Be.fill)||void 0===u?void 0:u.description}))]}))]}))}))]})})]}))]})),s(oe,{}),i("div",Object.assign({className:"space-y-3"},{children:[i("div",Object.assign({className:"flex items-center justify-between"},{children:[i("div",Object.assign({className:"space-y-0.5"},{children:[s(X,Object.assign({htmlFor:"controls",className:"text-sm font-medium"},{children:"Show controls"})),s("p",Object.assign({className:"text-xs text-muted-foreground"},{children:"Display video player controls"}))]})),s(Ae,{id:"controls",checked:null!==(p=t.controls)&&void 0!==p&&p,onCheckedChange:e=>x({controls:e})})]})),i("div",Object.assign({className:"flex items-center justify-between"},{children:[i("div",Object.assign({className:"space-y-0.5"},{children:[s(X,Object.assign({htmlFor:"loop",className:"text-sm font-medium"},{children:"Loop video"})),s("p",Object.assign({className:"text-xs text-muted-foreground"},{children:"Automatically replay when finished"}))]})),s(Ae,{id:"loop",checked:null!==(g=t.loop)&&void 0!==g&&g,onCheckedChange:e=>x({loop:e})})]})),i("div",Object.assign({className:"flex items-center justify-between"},{children:[i("div",Object.assign({className:"space-y-0.5"},{children:[s(X,Object.assign({htmlFor:"muted",className:"text-sm font-medium"},{children:"Muted"})),s("p",Object.assign({className:"text-xs text-muted-foreground"},{children:"Start video without sound"}))]})),s(Ae,{id:"muted",checked:null!==(b=t.muted)&&void 0!==b&&b,onCheckedChange:e=>x({muted:e})})]})),i("div",Object.assign({className:"flex items-center justify-between"},{children:[i("div",Object.assign({className:"space-y-0.5"},{children:[s(X,Object.assign({htmlFor:"autoplay",className:"text-sm font-medium"},{children:"Autoplay"})),s("p",Object.assign({className:"text-xs text-muted-foreground"},{children:"Start playing automatically (may require muted)"}))]})),s(Ae,{id:"autoplay",checked:null!==(v=t.autoPlay)&&void 0!==v&&v,onCheckedChange:e=>x({autoPlay:e})})]}))]}))]}))}))]}))},Te=({referenceRef:e,elementProps:t,onUpdate:a,onReplace:r,onDelete:c,onDownload:d,onCopy:h})=>{var m,u;const[p,g]=l(!1),[b,v]=l(!1),f=t.provider&&t.provider.type,j="alignment"in t,{refs:x,floatingStyles:w}=$({placement:"top-end",strategy:"absolute",middleware:[ge(8),be({fallbackPlacements:["bottom-end","top-start","bottom-start"],padding:10}),ve({padding:10})],whileElementsMounted:fe});o(()=>{const t=e.current;t&&(x.setReference(t),v(!0))},[e,x]),o(()=>{if(b){const e=requestAnimationFrame(()=>{g(!0)});return()=>cancelAnimationFrame(e)}},[b]);return b?s(Y,{children:s("div",Object.assign({ref:x.setFloating,onMouseDown:e=>{e.preventDefault(),e.stopPropagation()},onClick:e=>e.stopPropagation(),className:U("pointer-events-auto","flex items-center gap-1 rounded-lg border bg-background/95 backdrop-blur-sm p-1 shadow-lg","transition-opacity duration-200 ease-out",p?"opacity-100 translate-y-0":"opacity-0 translate-y-2"),style:w},{children:i(B,Object.assign({delayDuration:0},{children:[j&&i("div",Object.assign({className:"flex items-center gap-0.5 border-r pr-1"},{children:[i(_,{children:[s(T,Object.assign({asChild:!0},{children:s(k,Object.assign({variant:"left"===t.alignment?"secondary":"ghost",size:"icon",className:"h-7 w-7",onClick:()=>a({alignment:"left"})},{children:s(L,{className:"h-4 w-4"})}))})),s(q,{children:"Align left"})]}),i(_,{children:[s(T,Object.assign({asChild:!0},{children:s(k,Object.assign({variant:"center"===t.alignment?"secondary":"ghost",size:"icon",className:"h-7 w-7",onClick:()=>a({alignment:"center"})},{children:s(W,{className:"h-4 w-4"})}))})),s(q,{children:"Align center"})]}),i(_,{children:[s(T,Object.assign({asChild:!0},{children:s(k,Object.assign({variant:"right"===t.alignment?"secondary":"ghost",size:"icon",className:"h-7 w-7",onClick:()=>a({alignment:"right"})},{children:s(F,{className:"h-4 w-4"})}))})),s(q,{children:"Align right"})]})]})),i(_,{children:[s(T,Object.assign({asChild:!0},{children:s(k,Object.assign({variant:"ghost",size:"icon",className:"h-7 w-7",onClick:r},{children:s(K,{className:"h-4 w-4"})}))})),s(q,{children:"Replace"})]}),!f&&t.src&&i(n,{children:[i(_,{children:[s(T,Object.assign({asChild:!0},{children:s(k,Object.assign({variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>{if(d)d();else if(t.src&&!f){const e=document.createElement("a");e.href=t.src,e.download=`video-${Date.now()}.mp4`,e.click()}}},{children:s(D,{className:"h-4 w-4"})}))})),s(q,{children:"Download"})]}),i(_,{children:[s(T,Object.assign({asChild:!0},{children:s(k,Object.assign({variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>{h?h():t.src&&J(t.src)}},{children:s(G,{className:"h-4 w-4"})}))})),s(q,{children:"Copy URL"})]})]}),f&&(null===(m=t.provider)||void 0===m?void 0:m.url)&&i(_,{children:[s(T,Object.assign({asChild:!0},{children:s(k,Object.assign({variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>{var e;(null===(e=t.provider)||void 0===e?void 0:e.url)&&window.open(t.provider.url,"_blank")}},{children:s(xe,{className:"h-4 w-4"})}))})),s(q,{children:"Open in new tab"})]}),!f&&i(n,{children:[s(oe,{orientation:"vertical",className:"h-4"}),s(_e,{fit:null!==(u=t.fit)&&void 0!==u?u:"contain",settings:t.settings||{controls:!1,loop:!1,muted:!1,autoPlay:!1},onUpdate:a})]}),i(_,{children:[s(T,Object.assign({asChild:!0},{children:s(k,Object.assign({variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:bg-destructive/10 hover:text-destructive",onClick:c},{children:s(we,{className:"h-4 w-4"})}))})),s(q,{children:"Delete"})]})]}))}))}):null},qe=({blockId:e,attributes:n,children:a,elementProps:o,onUpdate:d,onDelete:p,onReplace:g,pluginOptions:b})=>{var v,j,x,w;const[y,N]=l(o.sizes),{isElementSelected:O}=h(),k=m({blockId:e}),C=O&&k,z=r(null),I=u(),[E,R]=l(()=>{var e;const t=(null===(e=I.refElement)||void 0===e?void 0:e.getBoundingClientRect().width)||1/0,i=null==b?void 0:b.maxSizes;return{maxWidth:(null==i?void 0:i.maxWidth)?"number"==typeof i.maxWidth?i.maxWidth:parseInt(String(i.maxWidth).replace(/[^\d]/g,""),10):t,maxHeight:(null==i?void 0:i.maxHeight)?"number"==typeof i.maxHeight?i.maxHeight:parseInt(String(i.maxHeight).replace(/[^\d]/g,""),10):1/0}});c(()=>{const e=()=>{var e;const t=(null===(e=I.refElement)||void 0===e?void 0:e.getBoundingClientRect().width)||1/0,i=null==b?void 0:b.maxSizes;R({maxWidth:(null==i?void 0:i.maxWidth)?"number"==typeof i.maxWidth?i.maxWidth:parseInt(String(i.maxWidth).replace(/[^\d]/g,""),10):t,maxHeight:(null==i?void 0:i.maxHeight)?"number"==typeof i.maxHeight?i.maxHeight:parseInt(String(i.maxHeight).replace(/[^\d]/g,""),10):1/0})};e();const t=new ResizeObserver(e);return I.refElement&&t.observe(I.refElement),window.addEventListener("resize",e),()=>{t.disconnect(),window.removeEventListener("resize",e)}},[I,b]);const S=(e,t)=>{const i=e=>"number"==typeof e?e:parseInt(String(e).replace(/[^\d]/g,""),10),s=i(e.width),n=i(e.height),a=i(t.width),r=i(t.height);if(s<=a&&n<=r)return{width:s,height:n};const l=s/a,o=n/r,c=Math.max(l,o),d=Math.round(s/c),h=Math.round(n/c);return{width:Math.min(d,a),height:Math.min(h,r)}},P=o.provider&&o.provider.type,D=o.src||"",H=P&&(null===(v=o.provider)||void 0===v?void 0:v.id)?f(o.provider.type,o.provider.id):null,L=o.settings||{controls:!0,loop:!1,muted:!1,autoPlay:!1},W={left:"justify-start",center:"justify-center",right:"justify-end"}[null!==(j=o.alignment)&&void 0!==j?j:"center"];return i("div",Object.assign({},n,{className:U("group/video mt-4 relative transition-all w-full flex",W)},{children:[i("div",Object.assign({className:"relative",contentEditable:!1},{children:[s(M,Object.assign({ref:e=>{(null==e?void 0:e.resizableElement)&&e.resizableElement instanceof HTMLElement&&(z.current=e.resizableElement)},style:{position:"relative",outline:C?".125rem solid rgba(0, 0, 0, 0)":"none",outlineColor:C?"hsl(var(--primary))":"none",padding:2},onResize:(e,t,i)=>{const s=parseInt(i.style.width,10),n=parseInt(i.style.height,10),a=S({width:s,height:n},{width:E.maxWidth,height:E.maxHeight});N(a)},onResizeStop:(e,t,i)=>{const s=parseInt(i.style.width,10),n=parseInt(i.style.height,10),a=S({width:s,height:n},{width:E.maxWidth,height:E.maxHeight});d({sizes:a})},lockAspectRatio:!0,minWidth:200,minHeight:150,maxWidth:E.maxWidth,maxHeight:E.maxHeight,position:{x:1/0,y:0},enableResizing:!!C&&{bottom:!1,bottomLeft:!1,bottomRight:!1,left:!0,right:!0,top:!1,topLeft:!1,topRight:!1},disableDragging:!0,resizeHandleStyles:{left:{width:"auto",height:"40px",left:"-5px",top:"50%",transform:"translateY(-50%)",cursor:"ew-resize"},right:{width:"auto",height:"40px",right:"-5px",top:"50%",transform:"translateY(-50%)",cursor:"ew-resize"}},resizeHandleComponent:{left:s("div",{className:"h-10 w-2 rounded-full bg-primary shadow-md ring-2 ring-white/80"}),right:s("div",{className:"h-10 w-2 rounded-full bg-primary shadow-md ring-2 ring-white/80"})},className:U("rounded-sm overflow-hidden")},{children:P&&H?s("iframe",{title:o.provider.type,src:H,width:"100%",height:"100%",frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,className:"w-full h-full",style:{aspectRatio:`${null==y?void 0:y.width} / ${null==y?void 0:y.height}`}}):s("video",{title:"Video",src:D,controls:L.controls,loop:L.loop,muted:L.muted,autoPlay:L.autoPlay,poster:null!==(x=o.poster)&&void 0!==x?x:void 0,className:"w-full h-full transition-all duration-200",style:{objectFit:null!==(w=o.fit)&&void 0!==w?w:"contain"},draggable:!1})})),C&&s(Te,{referenceRef:z,elementProps:o,onUpdate:d,onReplace:g,onDelete:p,onDownload:()=>t(void 0,void 0,void 0,function*(){if(o.src&&!P)try{const e=yield fetch(o.src),t=yield e.blob(),i=URL.createObjectURL(t),s=document.createElement("a");s.href=i,s.download=`video-${Date.now()}.mp4`,s.click(),URL.revokeObjectURL(i)}catch(e){}}),onCopy:()=>t(void 0,void 0,void 0,function*(){var e;if(o.src)try{if(P&&(null===(e=o.provider)||void 0===e?void 0:e.url)){const{default:e}=yield import("./chunks/index-0bca29df.js").then(function(e){return e.i});e(o.provider.url)}else{const e=yield fetch(o.src),t=yield e.blob();if(navigator.clipboard&&ClipboardItem)yield navigator.clipboard.write([new ClipboardItem({[t.type]:t})]);else{const{default:e}=yield import("./chunks/index-0bca29df.js").then(function(e){return e.i});e(o.src)}}}catch(e){const{default:t}=yield import("./chunks/index-0bca29df.js").then(function(e){return e.i});t(o.src||"")}})})]})),a]}))},$e={video:{render:({element:e,attributes:i,children:n,blockId:a})=>{const r=u(),l=p("Video"),{upload:o,progress:c,loading:h}=j(l.upload),{deleteVideo:m}=x(l.delete),{preview:f,generatePreview:k,clearPreview:C}=w(),z=d(t=>{g.updateElement(r,{blockId:a,type:"video",props:Object.assign(Object.assign({},e.props),t)})},[r,a,e.props]),I=d(()=>t(void 0,void 0,void 0,function*(){yield m(e);const t=b.getBlockSlate(r,{id:a});if(!t)return;const i=g.getElementPath(r,{blockId:a,element:e});if(!i)return;const s=i?N.parent(t,i):void 0;s&&O.isElement(s[0])&&!N.isEditor(s[0])?g.deleteElement(r,{blockId:a,type:"video",path:i}):b.deleteBlock(r,{blockId:a,focus:!0})}),[r,a,e,m]),E=d(()=>{g.updateElement(r,{blockId:a,type:"video",props:Object.assign(Object.assign({},e.props),{src:null,provider:null})})},[r,a,e.props]),R=d(i=>t(void 0,void 0,void 0,function*(){var t;const s=null===(t=i.target.files)||void 0===t?void 0:t[0];if(!s)return;k(s);const n=yield o(s);z({id:n.id||n.fileId,src:n.url,sizes:n.width&&n.height?{width:n.width,height:n.height}:e.props.sizes||{width:650,height:400},provider:n.provider||null,poster:n.poster||null}),C()}),[o,z,k,C,e.props.sizes]),U=d(i=>t(void 0,void 0,void 0,function*(){const t=v(i);if(t.isValid&&t.provider){const s=y(i);z({src:t.embedUrl,provider:s,sizes:e.props.sizes||{width:650,height:400}})}else i.trim()&&z({src:i.trim(),provider:null,sizes:e.props.sizes||{width:650,height:400}})}),[z,e.props.sizes]);return e.props.src||e.props.provider?s(qe,Object.assign({blockId:a,elementId:e.id,onUpdate:z,onDelete:I,attributes:i,onReplace:E,elementProps:e.props,pluginOptions:l},{children:n})):s(Ie,Object.assign({onUpload:R,preview:f,progress:c,loading:h,onInsertUrl:U,attributes:i},{children:n}))}}};export{$e as VideoUI};
|
|
7
|
+
*/const ye=V("Video",[["path",{d:"m22 8-6 4 6 4V8Z",key:"50v9me"}],["rect",{width:"14",height:"12",x:"2",y:"6",rx:"2",ry:"2",key:"1rqjg6"}]]),Ne=({preview:e})=>s("div",Object.assign({className:"absolute inset-0 overflow-hidden flex items-center justify-center bg-black/5"},{children:s("video",{src:e.url,className:"max-w-full max-h-full object-contain",style:{maxWidth:e.width||"100%",maxHeight:e.height||"100%"},controls:!1,muted:!0,draggable:!1})})),Oe=({progress:e})=>s("div",Object.assign({className:"absolute inset-0 z-20 flex flex-col items-center justify-center gap-4 bg-black/70 backdrop-blur-sm p-6"},{children:s("div",Object.assign({className:"w-full max-w-md space-y-4"},{children:t("div",Object.assign({className:"space-y-2"},{children:[t("div",Object.assign({className:"flex items-center justify-between text-sm"},{children:[s("span",Object.assign({className:"font-medium text-white"},{children:"Uploading video..."})),t("span",Object.assign({className:"text-white/80"},{children:[e.percentage,"%"]}))]})),s("div",Object.assign({className:"h-2 w-full overflow-hidden rounded-full bg-white/20"},{children:s("div",{className:"h-full bg-primary transition-all duration-300 ease-out",style:{width:`${e.percentage}%`}})})),t("div",Object.assign({className:"flex items-center justify-between text-xs text-white/60"},{children:[t("span",{children:[(e.loaded/1024/1024).toFixed(2)," MB /"," ",(e.total/1024/1024).toFixed(2)," MB"]}),s(P,{className:"h-3.5 w-3.5 animate-spin"})]}))]}))}))})),ke=({onUpload:e,hasPreview:i})=>{const n=r(null);return t("div",i?Object.assign({className:"flex flex-col items-center justify-center gap-4 py-8"},{children:[t("div",Object.assign({className:"text-center space-y-2"},{children:[s("p",Object.assign({className:"text-sm font-medium text-white"},{children:"Video preview"})),s("p",Object.assign({className:"text-xs text-white/80"},{children:"Uploading your video..."}))]})),s("input",{ref:n,type:"file",accept:"video/*",onChange:e,className:"hidden"})]}):Object.assign({className:"flex flex-col items-center gap-3 py-6"},{children:[s("div",Object.assign({className:"rounded-lg bg-muted p-3"},{children:s(ye,{className:"h-6 w-6 text-muted-foreground"})})),t("div",Object.assign({className:"text-center"},{children:[s("p",Object.assign({className:"text-sm font-medium"},{children:"Upload a video"})),s("p",Object.assign({className:"text-xs text-muted-foreground"},{children:"Click or drag and drop"}))]})),s(k,Object.assign({onClick:()=>{var e;return null===(e=n.current)||void 0===e?void 0:e.click()}},{children:"Choose file"})),s("input",{ref:n,type:"file",accept:"video/*",onChange:e,className:"hidden"})]}))},Ce=({onInsertUrl:e})=>{const[i,n]=l(""),[a,r]=l(!1),[o,c]=l(null),d=()=>{i.trim()&&(e(i.trim()),n(""),r(!1),c(null))};return t("div",Object.assign({className:"mt-4 space-y-3"},{children:[t("div",Object.assign({className:"space-y-2"},{children:[s(C,{placeholder:"Paste video URL (YouTube, Vimeo, Dailymotion, Loom, Wistia)...",value:i,onChange:e=>(e=>{if(n(e),e.trim()){const i=v(e.trim());r(i.isValid),c(i.provider?i.provider.charAt(0).toUpperCase()+i.provider.slice(1):null)}else r(!1),c(null)})(e.target.value),onKeyDown:e=>{"Enter"===e.key&&i.trim()&&a&&d()}}),i.trim()&&s("div",Object.assign({className:"text-xs text-muted-foreground"},{children:a?t("span",Object.assign({className:"flex items-center gap-1.5 text-green-600 dark:text-green-400"},{children:[s(A,{className:"h-3 w-3"}),o," video detected"]})):s("span",Object.assign({className:"text-destructive"},{children:"Invalid video URL. Supported: YouTube, Vimeo, Dailymotion, Loom, Wistia"}))}))]})),s(k,Object.assign({className:"w-full",onClick:d,disabled:!i.trim()||!a},{children:a?`Embed ${o} video`:"Embed video"}))]}))},ze=({onUpload:e,onInsertUrl:i,hasPreview:n})=>s("div",Object.assign({className:U("relative p-4",n&&"min-h-[300px] flex flex-col")},{children:t(z,Object.assign({defaultValue:"upload",className:"w-full"},{children:[t(I,Object.assign({className:U("grid w-full grid-cols-2",n&&"bg-background/80 backdrop-blur-sm")},{children:[t(E,Object.assign({value:"upload",className:"gap-1.5"},{children:[s(S,{className:"h-3.5 w-3.5"}),"Upload"]})),t(E,Object.assign({value:"link",className:"gap-1.5"},{children:[s(L,{className:"h-3.5 w-3.5"}),"Link"]}))]})),s(R,Object.assign({value:"upload",className:"mt-4"},{children:s(ke,{onUpload:e,hasPreview:n})})),s(R,Object.assign({value:"link"},{children:s(Ce,{onInsertUrl:i})}))]}))})),Ie=({onUpload:e,onInsertUrl:i,className:n,attributes:a,children:r,preview:l,progress:o,loading:c})=>{const d=null!==l&&!!l.url,h=c&&o;return t("div",Object.assign({className:U("mt-2 relative rounded-lg border bg-background overflow-hidden",d&&"min-h-[300px]",n)},a,{contentEditable:!1},{children:[d&&s(Ne,{preview:l}),!d&&s(ze,{onUpload:e,onInsertUrl:i,hasPreview:d}),h&&o&&s(Oe,{progress:o}),r]}))};var Ee="Switch",[Re,Ue]=ce(Ee),[Pe,Se]=Re(Ee),De=a.forwardRef((e,i)=>{const{__scopeSwitch:n,name:r,checked:l,defaultChecked:o,required:c,disabled:d,value:h="on",onCheckedChange:m,form:u,...p}=e,[g,b]=a.useState(null),v=me(i,e=>b(e)),f=a.useRef(!1),j=!g||(u||!!g.closest("form")),[x,w]=ue({prop:l,defaultProp:o??!1,onChange:m,caller:Ee});return t(Pe,{scope:n,checked:x,disabled:d,children:[s(de.button,{type:"button",role:"switch","aria-checked":x,"aria-required":c,"data-state":We(x),"data-disabled":d?"":void 0,disabled:d,value:h,...p,ref:v,onClick:he(e.onClick,e=>{w(e=>!e),j&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})}),j&&s(Fe,{control:g,bubbles:!f.current,name:r,value:h,checked:x,required:c,disabled:d,form:u,style:{transform:"translateX(-100%)"}})]})});De.displayName=Ee;var Le="SwitchThumb",He=a.forwardRef((e,i)=>{const{__scopeSwitch:t,...n}=e,a=Se(Le,t);return s(de.span,{"data-state":We(a.checked),"data-disabled":a.disabled?"":void 0,...n,ref:i})});He.displayName=Le;var Fe=a.forwardRef(({__scopeSwitch:e,control:i,checked:t,bubbles:n=!0,...r},l)=>{const o=a.useRef(null),c=me(o,l),d=ie(t),h=pe(i);return a.useEffect(()=>{const e=o.current;if(!e)return;const i=window.HTMLInputElement.prototype,s=Object.getOwnPropertyDescriptor(i,"checked").set;if(d!==t&&s){const i=new Event("click",{bubbles:n});s.call(e,t),e.dispatchEvent(i)}},[d,t,n]),s("input",{type:"checkbox","aria-hidden":!0,defaultChecked:t,...r,tabIndex:-1,ref:c,style:{...r.style,...h,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function We(e){return e?"checked":"unchecked"}Fe.displayName="SwitchBubbleInput";var _e=De,Ve=He;const Ae=a.forwardRef((i,t)=>{var{className:n}=i,a=e(i,["className"]);return s(_e,Object.assign({className:U("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",n)},a,{ref:t},{children:s(Ve,{className:U("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}))});Ae.displayName=_e.displayName;const Be={contain:{label:"Contain",description:"Fit within bounds"},cover:{label:"Cover",description:"Fill and crop"},fill:{label:"Fill",description:"Stretch to fit"}},qe=({fit:e,settings:i,onUpdate:n})=>{var a,r,o,c,d,h,m,u,p,g,b,v;const[f,j]=l(!1),x=e=>{n({settings:Object.assign(Object.assign({},i),e)})};return t(Z,Object.assign({open:f,onOpenChange:j},{children:[s(B,{children:t(q,{children:[s(M,Object.assign({asChild:!0},{children:s(Q,Object.assign({asChild:!0},{children:s(k,Object.assign({variant:f?"secondary":"ghost",size:"icon",className:"h-7 w-7"},{children:s(je,{className:"h-4 w-4"})}))}))})),s(T,{children:"Settings"})]})}),s(ee,Object.assign({className:"w-80 p-3",align:"start",contentEditable:!1,onMouseDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation()},{children:t("div",Object.assign({className:"space-y-3"},{children:[t("div",{children:[s("h4",Object.assign({className:"font-semibold"},{children:"Video settings"})),s("p",Object.assign({className:"text-xs text-muted-foreground"},{children:"Customize video playback and display"}))]}),s(oe,{}),t("div",Object.assign({className:"space-y-1"},{children:[s(X,Object.assign({htmlFor:"object-fit",className:"text-sm font-medium"},{children:"How video fits"})),t(te,Object.assign({value:e||"contain",onValueChange:e=>n({fit:e})},{children:[s(se,Object.assign({id:"object-fit",className:"h-9 w-full"},{children:s(ne,Object.assign({placeholder:"Select how video fits"},{children:t("div",Object.assign({className:"flex items-center gap-2"},{children:[s("div",Object.assign({className:"font-medium"},{children:null===(a=Be[e||"contain"])||void 0===a?void 0:a.label})),s("div",Object.assign({className:"text-xs text-muted-foreground"},{children:null===(r=Be[e||"contain"])||void 0===r?void 0:r.description}))]}))}))})),s(ae,{children:t(re,{children:[s(le,Object.assign({value:"contain",className:"cursor-pointer"},{children:t("div",Object.assign({className:"flex items-center gap-2"},{children:[s("div",Object.assign({className:"flex h-8 w-8 shrink-0 items-center justify-center rounded border"},{children:s("div",{className:"h-4 w-3 rounded bg-primary"})})),t("div",Object.assign({className:"flex-1"},{children:[s("div",Object.assign({className:"font-medium"},{children:null===(o=Be.contain)||void 0===o?void 0:o.label})),s("div",Object.assign({className:"text-xs text-muted-foreground"},{children:null===(c=Be.contain)||void 0===c?void 0:c.description}))]}))]}))})),s(le,Object.assign({value:"cover",className:"cursor-pointer"},{children:t("div",Object.assign({className:"flex items-center gap-2"},{children:[s("div",Object.assign({className:"flex h-8 w-8 shrink-0 items-center justify-center rounded border"},{children:s("div",{className:"h-8 w-6 rounded bg-primary"})})),t("div",Object.assign({className:"flex-1"},{children:[s("div",Object.assign({className:"font-medium"},{children:null===(d=Be.cover)||void 0===d?void 0:d.label})),s("div",Object.assign({className:"text-xs text-muted-foreground"},{children:null===(h=Be.cover)||void 0===h?void 0:h.description}))]}))]}))})),s(le,Object.assign({value:"fill",className:"cursor-pointer"},{children:t("div",Object.assign({className:"flex items-center gap-2"},{children:[s("div",Object.assign({className:"flex h-8 w-8 shrink-0 items-center justify-center rounded border"},{children:s("div",{className:"h-8 w-8 rounded bg-primary"})})),t("div",Object.assign({className:"flex-1"},{children:[s("div",Object.assign({className:"font-medium"},{children:null===(m=Be.fill)||void 0===m?void 0:m.label})),s("div",Object.assign({className:"text-xs text-muted-foreground"},{children:null===(u=Be.fill)||void 0===u?void 0:u.description}))]}))]}))}))]})})]}))]})),s(oe,{}),t("div",Object.assign({className:"space-y-3"},{children:[t("div",Object.assign({className:"flex items-center justify-between"},{children:[t("div",Object.assign({className:"space-y-0.5"},{children:[s(X,Object.assign({htmlFor:"controls",className:"text-sm font-medium"},{children:"Show controls"})),s("p",Object.assign({className:"text-xs text-muted-foreground"},{children:"Display video player controls"}))]})),s(Ae,{id:"controls",checked:null!==(p=i.controls)&&void 0!==p&&p,onCheckedChange:e=>x({controls:e})})]})),t("div",Object.assign({className:"flex items-center justify-between"},{children:[t("div",Object.assign({className:"space-y-0.5"},{children:[s(X,Object.assign({htmlFor:"loop",className:"text-sm font-medium"},{children:"Loop video"})),s("p",Object.assign({className:"text-xs text-muted-foreground"},{children:"Automatically replay when finished"}))]})),s(Ae,{id:"loop",checked:null!==(g=i.loop)&&void 0!==g&&g,onCheckedChange:e=>x({loop:e})})]})),t("div",Object.assign({className:"flex items-center justify-between"},{children:[t("div",Object.assign({className:"space-y-0.5"},{children:[s(X,Object.assign({htmlFor:"muted",className:"text-sm font-medium"},{children:"Muted"})),s("p",Object.assign({className:"text-xs text-muted-foreground"},{children:"Start video without sound"}))]})),s(Ae,{id:"muted",checked:null!==(b=i.muted)&&void 0!==b&&b,onCheckedChange:e=>x({muted:e})})]})),t("div",Object.assign({className:"flex items-center justify-between"},{children:[t("div",Object.assign({className:"space-y-0.5"},{children:[s(X,Object.assign({htmlFor:"autoplay",className:"text-sm font-medium"},{children:"Autoplay"})),s("p",Object.assign({className:"text-xs text-muted-foreground"},{children:"Start playing automatically (may require muted)"}))]})),s(Ae,{id:"autoplay",checked:null!==(v=i.autoPlay)&&void 0!==v&&v,onCheckedChange:e=>x({autoPlay:e})})]}))]}))]}))}))]}))},Me=({referenceRef:e,elementProps:i,onUpdate:a,onReplace:r,onDelete:c,onDownload:d,onCopy:m})=>{var u,p;const[g,b]=l(!1),[v,f]=l(!1),j=i.provider&&i.provider.type,x="alignment"in i,w=h(),{refs:y,floatingStyles:N}=$({placement:"top-end",strategy:"absolute",middleware:[ge(8),be({fallbackPlacements:["bottom-end","top-start","bottom-start"],padding:10}),ve({padding:10})],whileElementsMounted:fe});o(()=>{const i=e.current;i&&(y.setReference(i),f(!0))},[e,y]),o(()=>{if(v){const e=requestAnimationFrame(()=>{b(!0)});return()=>cancelAnimationFrame(e)}},[v]);return v?s(Y,Object.assign({id:"video-inline-toolbar",root:w.refElement},{children:s("div",Object.assign({ref:y.setFloating,onMouseDown:e=>{e.preventDefault(),e.stopPropagation()},onClick:e=>e.stopPropagation(),className:U("pointer-events-auto","flex items-center gap-1 rounded-lg border bg-background/95 backdrop-blur-sm p-1 shadow-lg","transition-opacity duration-200 ease-out",g?"opacity-100 translate-y-0":"opacity-0 translate-y-2"),style:N},{children:t(B,Object.assign({delayDuration:0},{children:[x&&t("div",Object.assign({className:"flex items-center gap-0.5 border-r pr-1"},{children:[t(q,{children:[s(M,Object.assign({asChild:!0},{children:s(k,Object.assign({variant:"left"===i.alignment?"secondary":"ghost",size:"icon",className:"h-7 w-7",onClick:()=>a({alignment:"left"})},{children:s(H,{className:"h-4 w-4"})}))})),s(T,{children:"Align left"})]}),t(q,{children:[s(M,Object.assign({asChild:!0},{children:s(k,Object.assign({variant:"center"===i.alignment?"secondary":"ghost",size:"icon",className:"h-7 w-7",onClick:()=>a({alignment:"center"})},{children:s(F,{className:"h-4 w-4"})}))})),s(T,{children:"Align center"})]}),t(q,{children:[s(M,Object.assign({asChild:!0},{children:s(k,Object.assign({variant:"right"===i.alignment?"secondary":"ghost",size:"icon",className:"h-7 w-7",onClick:()=>a({alignment:"right"})},{children:s(W,{className:"h-4 w-4"})}))})),s(T,{children:"Align right"})]})]})),t(q,{children:[s(M,Object.assign({asChild:!0},{children:s(k,Object.assign({variant:"ghost",size:"icon",className:"h-7 w-7",onClick:r},{children:s(K,{className:"h-4 w-4"})}))})),s(T,{children:"Replace"})]}),!j&&i.src&&t(n,{children:[t(q,{children:[s(M,Object.assign({asChild:!0},{children:s(k,Object.assign({variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>{if(d)d();else if(i.src&&!j){const e=document.createElement("a");e.href=i.src,e.download=`video-${Date.now()}.mp4`,e.click()}}},{children:s(D,{className:"h-4 w-4"})}))})),s(T,{children:"Download"})]}),t(q,{children:[s(M,Object.assign({asChild:!0},{children:s(k,Object.assign({variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>{m?m():i.src&&J(i.src)}},{children:s(G,{className:"h-4 w-4"})}))})),s(T,{children:"Copy URL"})]})]}),j&&(null===(u=i.provider)||void 0===u?void 0:u.url)&&t(q,{children:[s(M,Object.assign({asChild:!0},{children:s(k,Object.assign({variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>{var e;(null===(e=i.provider)||void 0===e?void 0:e.url)&&window.open(i.provider.url,"_blank")}},{children:s(xe,{className:"h-4 w-4"})}))})),s(T,{children:"Open in new tab"})]}),!j&&t(n,{children:[s(oe,{orientation:"vertical",className:"h-4"}),s(qe,{fit:null!==(p=i.fit)&&void 0!==p?p:"contain",settings:i.settings||{controls:!1,loop:!1,muted:!1,autoPlay:!1},onUpdate:a})]}),t(q,{children:[s(M,Object.assign({asChild:!0},{children:s(k,Object.assign({variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:bg-destructive/10 hover:text-destructive",onClick:c},{children:s(we,{className:"h-4 w-4"})}))})),s(T,{children:"Delete"})]})]}))}))})):null},Te=({blockId:e,attributes:n,children:a,elementProps:o,onUpdate:d,onDelete:p,onReplace:g,pluginOptions:b})=>{var v,j,x,w,y;const[N,O]=l(o.sizes),{isElementSelected:k}=m(),C=u({blockId:e}),z=k&&C,I=r(null),E=h(),[R,P]=l(()=>{var e;const i=(null===(e=E.refElement)||void 0===e?void 0:e.getBoundingClientRect().width)||0,t=null==b?void 0:b.maxSizes;return{maxWidth:(null==t?void 0:t.maxWidth)?"number"==typeof t.maxWidth?t.maxWidth:parseInt(String(t.maxWidth).replace(/[^\d]/g,""),10):i,maxHeight:(null==t?void 0:t.maxHeight)?"number"==typeof t.maxHeight?t.maxHeight:parseInt(String(t.maxHeight).replace(/[^\d]/g,""),10):0}});c(()=>{const e=()=>{var e;const i=(null===(e=E.refElement)||void 0===e?void 0:e.getBoundingClientRect().width)||0,t=null==b?void 0:b.maxSizes;P({maxWidth:(null==t?void 0:t.maxWidth)?"number"==typeof t.maxWidth?t.maxWidth:parseInt(String(t.maxWidth).replace(/[^\d]/g,""),10):i,maxHeight:(null==t?void 0:t.maxHeight)?"number"==typeof t.maxHeight?t.maxHeight:parseInt(String(t.maxHeight).replace(/[^\d]/g,""),10):0})};e();const i=new ResizeObserver(e);return E.refElement&&i.observe(E.refElement),window.addEventListener("resize",e),()=>{i.disconnect(),window.removeEventListener("resize",e)}},[E,b]);const S=o.provider&&o.provider.type,D=o.src||"",L=S&&(null===(v=o.provider)||void 0===v?void 0:v.id)?f(o.provider.type,o.provider.id):null,H=null!==(j=o.settings)&&void 0!==j?j:{controls:!0,loop:!1,muted:!1,autoPlay:!1},F={left:"justify-start",center:"justify-center",right:"justify-end"}[null!==(x=o.alignment)&&void 0!==x?x:"center"];return t("div",Object.assign({},n,{className:U("group/video mt-4 relative transition-all w-full flex",F)},{children:[t("div",Object.assign({className:"relative",contentEditable:!1,ref:I},{children:[s(_,Object.assign({style:{position:"relative",outline:z?".125rem solid rgba(0, 0, 0, 0)":"none",outlineColor:z?"hsl(var(--primary))":"none",padding:2},onResize:(e,i,t)=>{const s=parseInt(t.style.width,10),n=parseInt(t.style.height,10);O({width:s,height:n})},onResizeStop:(e,i,t)=>{const s=parseInt(t.style.width,10),n=parseInt(t.style.height,10);d({sizes:{width:s,height:n}})},lockAspectRatio:!0,minWidth:200,minHeight:150,maxWidth:R.maxWidth-8||void 0,maxHeight:R.maxHeight||void 0,position:{x:0,y:0},enableResizing:!!z&&{bottom:!1,bottomLeft:!1,bottomRight:!1,left:!0,right:!0,top:!1,topLeft:!1,topRight:!1},disableDragging:!0,resizeHandleStyles:{left:{width:"auto",height:"40px",left:"5px",top:"50%",transform:"translateY(-50%)",cursor:"ew-resize"},right:{width:"auto",height:"40px",right:"5px",top:"50%",transform:"translateY(-50%)",cursor:"ew-resize"}},resizeHandleComponent:{left:s("div",{className:"h-10 w-1.5 rounded-full bg-white border border-border shadow-[0_0_4px_rgba(0,0,0,0.3)]"}),right:s("div",{className:"h-10 w-1.5 rounded-full bg-white border border-border shadow-[0_0_4px_rgba(0,0,0,0.3)]"})},className:U("rounded-sm overflow-hidden")},{children:S&&L?s("iframe",{title:o.provider.type,src:L,width:"100%",height:"100%",frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,className:"w-full h-full",style:{aspectRatio:`${null==N?void 0:N.width} / ${null==N?void 0:N.height}`}}):s("video",{title:"Video",src:D,controls:H.controls,loop:H.loop,muted:H.muted,autoPlay:H.autoPlay,poster:null!==(w=o.poster)&&void 0!==w?w:void 0,className:"w-full h-full transition-all duration-200",style:{objectFit:null!==(y=o.fit)&&void 0!==y?y:"contain"},draggable:!1})})),z&&s(Me,{referenceRef:I,elementProps:o,onUpdate:d,onReplace:g,onDelete:p,onDownload:()=>i(void 0,void 0,void 0,function*(){if(o.src&&!S)try{const e=yield fetch(o.src),i=yield e.blob(),t=URL.createObjectURL(i),s=document.createElement("a");s.href=t,s.download=`video-${Date.now()}.mp4`,s.click(),URL.revokeObjectURL(t)}catch(e){}}),onCopy:()=>i(void 0,void 0,void 0,function*(){var e;if(o.src)try{if(S&&(null===(e=o.provider)||void 0===e?void 0:e.url)){const{default:e}=yield import("./chunks/index-0bca29df.js").then(function(e){return e.i});e(o.provider.url)}else{const e=yield fetch(o.src),i=yield e.blob();if(navigator.clipboard&&ClipboardItem)yield navigator.clipboard.write([new ClipboardItem({[i.type]:i})]);else{const{default:e}=yield import("./chunks/index-0bca29df.js").then(function(e){return e.i});e(o.src)}}}catch(e){const{default:i}=yield import("./chunks/index-0bca29df.js").then(function(e){return e.i});i(o.src||"")}})})]})),a]}))},$e={video:{render:({element:e,attributes:t,children:n,blockId:a})=>{const r=h(),l=p("Video"),{upload:o,progress:c,loading:m}=j(l.upload),{deleteVideo:u}=x(l.delete),{preview:f,generatePreview:k,clearPreview:C}=w(),z=d(i=>{g.updateElement(r,{blockId:a,type:"video",props:Object.assign(Object.assign({},e.props),i)})},[r,a,e.props]),I=d(()=>i(void 0,void 0,void 0,function*(){yield u(e);const i=b.getBlockSlate(r,{id:a});if(!i)return;const t=g.getElementPath(r,{blockId:a,element:e});if(!t)return;const s=t?N.parent(i,t):void 0;s&&O.isElement(s[0])&&!N.isEditor(s[0])?g.deleteElement(r,{blockId:a,type:"video",path:t}):b.deleteBlock(r,{blockId:a,focus:!0})}),[r,a,e,u]),E=d(()=>{g.updateElement(r,{blockId:a,type:"video",props:Object.assign(Object.assign({},e.props),{src:null,provider:null})})},[r,a,e.props]),R=d(t=>i(void 0,void 0,void 0,function*(){var i;const s=null===(i=t.target.files)||void 0===i?void 0:i[0];if(!s)return;k(s);const n=yield o(s);z({id:n.id||n.fileId,src:n.url,sizes:n.width&&n.height?{width:n.width,height:n.height}:e.props.sizes||{width:650,height:400},provider:n.provider||null,poster:n.poster||null}),C()}),[o,z,k,C,e.props.sizes]),U=d(t=>i(void 0,void 0,void 0,function*(){const i=v(t);if(i.isValid&&i.provider){const s=y(t);z({src:i.embedUrl,provider:s,sizes:e.props.sizes||{width:650,height:400}})}else t.trim()&&z({src:t.trim(),provider:null,sizes:e.props.sizes||{width:650,height:400}})}),[z,e.props.sizes]);return e.props.src||e.props.provider?s(Te,Object.assign({blockId:a,elementId:e.id,onUpdate:z,onDelete:I,attributes:t,onReplace:E,elementProps:e.props,pluginOptions:l},{children:n})):r.readOnly?null:s(Ie,Object.assign({onUpload:R,preview:f,progress:c,loading:m,onInsertUrl:U,attributes:t},{children:n}))}}};export{$e as VideoUI};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yoopta/themes-shadcn",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.3",
|
|
4
4
|
"description": "Shadcn UI theme for Yoopta Editor plugins",
|
|
5
5
|
"author": "Darginec05 <devopsbanda@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/Darginec05/Yoopta-Editor#readme",
|
|
@@ -50,6 +50,9 @@
|
|
|
50
50
|
"lists": [
|
|
51
51
|
"./dist/types/lists/index.d.ts"
|
|
52
52
|
],
|
|
53
|
+
"math": [
|
|
54
|
+
"./dist/types/math/index.d.ts"
|
|
55
|
+
],
|
|
53
56
|
"mention": [
|
|
54
57
|
"./dist/types/mention/index.d.ts"
|
|
55
58
|
],
|
|
@@ -134,6 +137,10 @@
|
|
|
134
137
|
"types": "./dist/types/lists/index.d.ts",
|
|
135
138
|
"import": "./dist/lists.js"
|
|
136
139
|
},
|
|
140
|
+
"./math": {
|
|
141
|
+
"types": "./dist/types/math/index.d.ts",
|
|
142
|
+
"import": "./dist/math.js"
|
|
143
|
+
},
|
|
137
144
|
"./mention": {
|
|
138
145
|
"types": "./dist/types/mention/index.d.ts",
|
|
139
146
|
"import": "./dist/mention.js"
|
|
@@ -171,18 +178,18 @@
|
|
|
171
178
|
"dist/"
|
|
172
179
|
],
|
|
173
180
|
"peerDependencies": {
|
|
174
|
-
"@yoopta/code": "^6.0.
|
|
175
|
-
"@yoopta/editor": "^6.0.
|
|
176
|
-
"@yoopta/embed": "^6.0.
|
|
177
|
-
"@yoopta/file": "^6.0.
|
|
178
|
-
"@yoopta/image": "^6.0.
|
|
179
|
-
"@yoopta/lists": "^6.0.
|
|
180
|
-
"@yoopta/steps": "^6.0.
|
|
181
|
-
"@yoopta/table": "^6.0.
|
|
182
|
-
"@yoopta/table-of-contents": "^6.0.
|
|
183
|
-
"@yoopta/tabs": "^6.0.
|
|
184
|
-
"@yoopta/ui": "^6.0.
|
|
185
|
-
"@yoopta/video": "^6.0.
|
|
181
|
+
"@yoopta/code": "^6.0.3",
|
|
182
|
+
"@yoopta/editor": "^6.0.3",
|
|
183
|
+
"@yoopta/embed": "^6.0.3",
|
|
184
|
+
"@yoopta/file": "^6.0.3",
|
|
185
|
+
"@yoopta/image": "^6.0.3",
|
|
186
|
+
"@yoopta/lists": "^6.0.3",
|
|
187
|
+
"@yoopta/steps": "^6.0.3",
|
|
188
|
+
"@yoopta/table": "^6.0.3",
|
|
189
|
+
"@yoopta/table-of-contents": "^6.0.3",
|
|
190
|
+
"@yoopta/tabs": "^6.0.3",
|
|
191
|
+
"@yoopta/ui": "^6.0.3",
|
|
192
|
+
"@yoopta/video": "^6.0.3",
|
|
186
193
|
"react": ">=18.2.0",
|
|
187
194
|
"react-dom": ">=18.2.0",
|
|
188
195
|
"slate": "^0.120.0",
|
|
@@ -231,4 +238,4 @@
|
|
|
231
238
|
"url": "https://github.com/Darginec05/Yoopta-Editor/issues"
|
|
232
239
|
},
|
|
233
240
|
"gitHead": "0c1eed956a263573e6aff9bdf58dcaf834deadf5"
|
|
234
|
-
}
|
|
241
|
+
}
|