@yoopta/themes-shadcn 6.0.0-beta.1 → 6.0.0-beta.10
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/elements/accordion-item-heading.d.ts.map +1 -1
- package/dist/accordion.js +1 -0
- package/dist/{withShadcnUI.d.ts → applyTheme.d.ts} +3 -3
- package/dist/applyTheme.d.ts.map +1 -0
- package/dist/blockquote.js +1 -0
- package/dist/callout/elements/callout.d.ts.map +1 -1
- package/dist/callout.js +13 -0
- package/dist/carousel.js +1 -0
- package/dist/chunks/Combination-ee85502b.js +1 -0
- package/dist/chunks/_tslib-35bb891d.js +1 -0
- package/dist/chunks/arrow-right-07affdbc.js +13 -0
- package/dist/chunks/button-ecb0aed1.js +1 -0
- package/dist/chunks/card-94325fef.js +1 -0
- package/dist/chunks/check-9adcfdfa.js +7 -0
- package/dist/chunks/chevron-down-abe5f871.js +7 -0
- package/dist/chunks/chevron-up-5b4801a9.js +7 -0
- package/dist/chunks/code-734dab76.js +7 -0
- package/dist/chunks/createLucideIcon-70ab5429.js +26 -0
- package/dist/chunks/dropdown-menu-b5845753.js +13 -0
- package/dist/chunks/external-link-956d49c0.js +7 -0
- package/dist/chunks/file-text-f268c203.js +7 -0
- package/dist/chunks/hover-card-4448c400.js +1 -0
- package/dist/chunks/index-056e5c06.js +1 -0
- package/dist/chunks/index-13505606.js +1 -0
- package/dist/chunks/index-325e2e09.js +1 -0
- package/dist/chunks/index-3b428d14.js +13 -0
- package/dist/chunks/index-70f4e709.js +1 -0
- package/dist/chunks/index-7725d7e0.js +1 -0
- package/dist/chunks/index-842a4484.js +1 -0
- package/dist/chunks/index-8dc6d938.js +1 -0
- package/dist/chunks/index-91a5b8d5.js +1 -0
- package/dist/chunks/index-aaeb33b0.js +1 -0
- package/dist/chunks/index-b273f426.js +1 -0
- package/dist/chunks/index-e9d6a4a8.js +7 -0
- package/dist/chunks/input-2708c7f4.js +1 -0
- package/dist/chunks/label-a0e6fde2.js +1 -0
- package/dist/chunks/language-select-d2235078.js +7 -0
- package/dist/chunks/play-ae8c52d2.js +7 -0
- package/dist/chunks/plus-0381140e.js +7 -0
- package/dist/chunks/popover-53c769ba.js +1 -0
- package/dist/chunks/scroll-area-f7cd99a3.js +1 -0
- package/dist/chunks/select-c547d76b.js +7 -0
- package/dist/chunks/separator-7be92037.js +1 -0
- package/dist/chunks/sparkles-c8608d1b.js +7 -0
- package/dist/chunks/style-inject.es-e87a8d02.js +1 -0
- package/dist/chunks/tabs-eeea28d9.js +1 -0
- package/dist/chunks/tooltip-bc45d963.js +7 -0
- package/dist/chunks/trash-2-8f855002.js +7 -0
- package/dist/chunks/upload-3b3687f2.js +13 -0
- package/dist/chunks/utils-de9c4c2b.js +1 -0
- package/dist/chunks/x-ec326bc0.js +7 -0
- package/dist/code/elements/code.d.ts.map +1 -1
- package/dist/code/elements/language-select.d.ts.map +1 -1
- package/dist/code-group/elements/code-group-content.d.ts.map +1 -1
- package/dist/code-group/elements/code-group-item-heading.d.ts.map +1 -1
- package/dist/code-group/elements/code-group-list.d.ts.map +1 -1
- package/dist/code-group.js +1 -0
- package/dist/code.js +1 -0
- package/dist/divider/elements/divider.d.ts.map +1 -1
- package/dist/divider.js +1 -0
- package/dist/embed/elements/embed/embed-element.d.ts +3 -0
- package/dist/embed/elements/embed/embed-element.d.ts.map +1 -0
- package/dist/embed/elements/embed/embed-inline-toolbar.d.ts +13 -0
- package/dist/embed/elements/embed/embed-inline-toolbar.d.ts.map +1 -0
- package/dist/embed/elements/embed/embed-placeholder.d.ts +11 -0
- package/dist/embed/elements/embed/embed-placeholder.d.ts.map +1 -0
- package/dist/embed/elements/embed/embed-render.d.ts +18 -0
- package/dist/embed/elements/embed/embed-render.d.ts.map +1 -0
- package/dist/embed/index.d.ts +6 -0
- package/dist/embed/index.d.ts.map +1 -0
- package/dist/embed/types.d.ts +3 -0
- package/dist/embed/types.d.ts.map +1 -0
- package/dist/embed.js +13 -0
- package/dist/file/elements/file/file-element.d.ts +3 -0
- package/dist/file/elements/file/file-element.d.ts.map +1 -0
- package/dist/file/elements/file/file-icons.d.ts +14 -0
- package/dist/file/elements/file/file-icons.d.ts.map +1 -0
- package/dist/file/elements/file/file-inline-toolbar.d.ts +12 -0
- package/dist/file/elements/file/file-inline-toolbar.d.ts.map +1 -0
- package/dist/file/elements/file/file-placeholder.d.ts +15 -0
- package/dist/file/elements/file/file-placeholder.d.ts.map +1 -0
- package/dist/file/elements/file/file-render.d.ts +14 -0
- package/dist/file/elements/file/file-render.d.ts.map +1 -0
- package/dist/file/index.d.ts +6 -0
- package/dist/file/index.d.ts.map +1 -0
- package/dist/file/types.d.ts +3 -0
- package/dist/file/types.d.ts.map +1 -0
- package/dist/file.js +13 -0
- package/dist/headings.js +1 -0
- package/dist/image/elements/image/image-placeholder.d.ts.map +1 -1
- package/dist/image/elements/image/image-render.d.ts +1 -1
- package/dist/image/elements/image/image-render.d.ts.map +1 -1
- package/dist/image.js +7 -0
- package/dist/index.d.ts +8 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -14
- package/dist/link/elements/link/link-element.d.ts.map +1 -1
- package/dist/link/elements/link/link-preview.d.ts.map +1 -1
- package/dist/link.js +7 -0
- package/dist/lists.js +1 -0
- package/dist/mention/elements/mention/mention-avatar.d.ts +10 -0
- package/dist/mention/elements/mention/mention-avatar.d.ts.map +1 -0
- package/dist/mention/elements/mention/mention-dropdown.d.ts +8 -0
- package/dist/mention/elements/mention/mention-dropdown.d.ts.map +1 -0
- package/dist/mention/elements/mention/mention-element.d.ts +3 -0
- package/dist/mention/elements/mention/mention-element.d.ts.map +1 -0
- package/dist/mention/elements/mention/mention-item.d.ts +11 -0
- package/dist/mention/elements/mention/mention-item.d.ts.map +1 -0
- package/dist/mention/index.d.ts +11 -0
- package/dist/mention/index.d.ts.map +1 -0
- package/dist/mention/types.d.ts +17 -0
- package/dist/mention/types.d.ts.map +1 -0
- package/dist/mention.js +13 -0
- package/dist/paragraph.js +1 -0
- package/dist/steps/elements/steps-container.d.ts.map +1 -1
- package/dist/steps/elements/steps-list-item.d.ts.map +1 -1
- package/dist/steps.js +1 -0
- package/dist/table/components/add-column-button.d.ts +1 -3
- package/dist/table/components/add-column-button.d.ts.map +1 -1
- package/dist/table/components/add-row-button.d.ts +1 -3
- package/dist/table/components/add-row-button.d.ts.map +1 -1
- package/dist/table/components/column-controls.d.ts +1 -5
- package/dist/table/components/column-controls.d.ts.map +1 -1
- package/dist/table/components/column-resize-handles.d.ts +6 -0
- package/dist/table/components/column-resize-handles.d.ts.map +1 -0
- package/dist/table/components/row-controls.d.ts +1 -5
- package/dist/table/components/row-controls.d.ts.map +1 -1
- package/dist/table/components/table-controls.d.ts.map +1 -1
- package/dist/table/elements/table-data-cell.d.ts.map +1 -1
- package/dist/table/elements/table.d.ts.map +1 -1
- package/dist/table-of-contents/elements/table-of-contents.d.ts +3 -0
- package/dist/table-of-contents/elements/table-of-contents.d.ts.map +1 -0
- package/dist/table-of-contents/index.d.ts +6 -0
- package/dist/table-of-contents/index.d.ts.map +1 -0
- package/dist/table-of-contents.js +1 -0
- package/dist/table.js +13 -0
- package/dist/tabs/elements/tabs-item-heading.d.ts.map +1 -1
- package/dist/tabs/elements/tabs-list.d.ts.map +1 -1
- package/dist/tabs.js +1 -0
- package/dist/ui/switch.d.ts +5 -0
- package/dist/ui/switch.d.ts.map +1 -0
- package/dist/video/elements/video/video-element.d.ts +3 -0
- package/dist/video/elements/video/video-element.d.ts.map +1 -0
- package/dist/video/elements/video/video-inline-toolbar-settings.d.ts +14 -0
- package/dist/video/elements/video/video-inline-toolbar-settings.d.ts.map +1 -0
- package/dist/video/elements/video/video-inline-toolbar.d.ts +14 -0
- package/dist/video/elements/video/video-inline-toolbar.d.ts.map +1 -0
- package/dist/video/elements/video/video-placeholder.d.ts +16 -0
- package/dist/video/elements/video/video-placeholder.d.ts.map +1 -0
- package/dist/video/elements/video/video-render.d.ts +18 -0
- package/dist/video/elements/video/video-render.d.ts.map +1 -0
- package/dist/video/index.d.ts +6 -0
- package/dist/video/index.d.ts.map +1 -0
- package/dist/video/types.d.ts +4 -0
- package/dist/video/types.d.ts.map +1 -0
- package/dist/video.js +7 -0
- package/package.json +172 -12
- package/dist/withShadcnUI.d.ts.map +0 -1
package/dist/divider.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsxs as r,jsx as e}from"react/jsx-runtime";import{useYooptaEditor as t,Blocks as o,Selection as d}from"@yoopta/editor";import"@yoopta/ui/element-options";import{S as a}from"./chunks/separator-7be92037.js";import{c as n}from"./chunks/utils-de9c4c2b.js";import"./chunks/_tslib-35bb891d.js";import"react";import"react-dom";import"./chunks/index-91a5b8d5.js";const s={divider:{render:s=>{var i,c,l;const b=t(),{attributes:p,element:u,blockId:m}=s,h=u,g=null!==(c=null===(i=h.props)||void 0===i?void 0:i.theme)&&void 0!==c?c:"solid",v=null===(l=h.props)||void 0===l?void 0:l.color;return r("div",Object.assign({},p,{contentEditable:!1,className:"group relative w-full py-3",onClick:()=>{const r=o.getBlock(b,{id:m});r&&d.setSelected(b,{at:r.meta.order})}},{children:[e(a,{orientation:"horizontal",decorative:!0,className:(()=>{switch(g){case"dashed":return n("border-t-2 border-dashed border-b-0 border-l-0 border-r-0 bg-transparent",v?"":"border-border");case"dotted":return n("border-t-2 border-dotted border-b-0 border-l-0 border-r-0 bg-transparent",v?"":"border-border");case"gradient":return"h-[2px] bg-transparent border-0";default:return n("h-[1px]",v?"":"bg-border")}})(),style:(()=>{if(!v)return{};switch(g){case"dashed":case"dotted":return{borderTopColor:v};case"gradient":return{background:`linear-gradient(to right, transparent, ${v}, transparent)`};default:return{backgroundColor:v}}})()}),s.children]}))}}};export{s as DividerUI};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embed-element.d.ts","sourceRoot":"","sources":["../../../../src/embed/elements/embed/embed-element.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,wBAAwB,EAA0B,MAAM,gBAAgB,CAAC;AAUvF,eAAO,MAAM,YAAY,+CAAgD,wBAAwB,4CA2FhG,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { EmbedElementProps } from '../../types';
|
|
3
|
+
type EmbedInlineToolbarProps = {
|
|
4
|
+
referenceRef: React.MutableRefObject<HTMLElement | null>;
|
|
5
|
+
elementProps: EmbedElementProps;
|
|
6
|
+
onUpdate: (props: Partial<EmbedElementProps>) => void;
|
|
7
|
+
onReplace: () => void;
|
|
8
|
+
onDelete: () => void;
|
|
9
|
+
onCopy?: () => void;
|
|
10
|
+
};
|
|
11
|
+
export declare const EmbedInlineToolbar: ({ referenceRef, elementProps, onUpdate, onReplace, onDelete, onCopy, }: EmbedInlineToolbarProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=embed-inline-toolbar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embed-inline-toolbar.d.ts","sourceRoot":"","sources":["../../../../src/embed/elements/embed/embed-inline-toolbar.tsx"],"names":[],"mappings":";AASA,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,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,kBAAkB,2EAO5B,uBAAuB,4CAoJzB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { PluginElementRenderProps } from '@yoopta/editor';
|
|
3
|
+
type EmbedPlaceholderProps = {
|
|
4
|
+
onInsertUrl: (url: string) => void;
|
|
5
|
+
className?: string;
|
|
6
|
+
attributes: PluginElementRenderProps['attributes'];
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
};
|
|
9
|
+
export declare const EmbedPlaceholder: ({ onInsertUrl, className, attributes, children, }: EmbedPlaceholderProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=embed-placeholder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embed-placeholder.d.ts","sourceRoot":"","sources":["../../../../src/embed/elements/embed/embed-placeholder.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAQ/D,KAAK,qBAAqB,GAAG;IAC3B,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,wBAAwB,CAAC,YAAY,CAAC,CAAC;IACnD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAiIF,eAAO,MAAM,gBAAgB,sDAK1B,qBAAqB,4CAyBvB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { PluginElementRenderProps } from '@yoopta/editor';
|
|
3
|
+
import type { EmbedPluginOptions } from '@yoopta/embed';
|
|
4
|
+
import type { EmbedElementProps } from '../../types';
|
|
5
|
+
type Props = {
|
|
6
|
+
blockId: string;
|
|
7
|
+
elementId: string;
|
|
8
|
+
onUpdate: (props: Partial<EmbedElementProps>) => void;
|
|
9
|
+
onDelete: () => void;
|
|
10
|
+
onReplace: () => void;
|
|
11
|
+
attributes: PluginElementRenderProps['attributes'];
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
elementProps: EmbedElementProps;
|
|
14
|
+
pluginOptions?: EmbedPluginOptions;
|
|
15
|
+
};
|
|
16
|
+
export declare const EmbedRender: ({ blockId, attributes, children, elementProps, onUpdate, onDelete, onReplace, pluginOptions, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=embed-render.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embed-render.d.ts","sourceRoot":"","sources":["../../../../src/embed/elements/embed/embed-render.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAE/D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAKxD,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,4CA0NP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/embed/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO;;;;CAInB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/embed/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,IAAI,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAEhF,MAAM,MAAM,iBAAiB,GAAG,qBAAqB,CAAC"}
|
package/dist/embed.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import{a as e}from"./chunks/_tslib-35bb891d.js";import{jsxs as t,jsx as i,Fragment as n}from"react/jsx-runtime";import{useState as s,useEffect as r,useRef as a,useCallback as l}from"react";import{useElementSelected as o,useBlockSelected as c,useYooptaEditor as d,useYooptaPluginOptions as m,Elements as h,Blocks as p}from"@yoopta/editor";import{detectProvider as u,getSupportedProviders as g,isEmbedUrl as b,parseEmbedUrl as v,calculateEmbedDimensions as f}from"@yoopta/embed";import{Editor as w,Element as y}from"slate";import{B as x}from"./chunks/button-ecb0aed1.js";import{I as j}from"./chunks/input-2708c7f4.js";import{c as k}from"./chunks/utils-de9c4c2b.js";import{L as N,A as O,a as C,b as E,R as z}from"./chunks/index-3b428d14.js";import{c as R}from"./chunks/createLucideIcon-70ab5429.js";import{C as I}from"./chunks/code-734dab76.js";import{P as M}from"./chunks/play-ae8c52d2.js";import{u as U,T as S,a as L,b as P,c as D,R as H}from"./chunks/tooltip-bc45d963.js";import{C as W,c as A}from"./chunks/index-e9d6a4a8.js";import{S as T}from"./chunks/separator-7be92037.js";import{E as B}from"./chunks/external-link-956d49c0.js";import{T as F}from"./chunks/trash-2-8f855002.js";import{o as V,i as Y,s as $,a as q}from"./chunks/index-842a4484.js";import"react-dom";import"./chunks/index-8dc6d938.js";import"./chunks/index-91a5b8d5.js";import"./chunks/index-325e2e09.js";import"./chunks/index-7725d7e0.js";import"./chunks/index-70f4e709.js";
|
|
2
|
+
/**
|
|
3
|
+
* @license lucide-react v0.378.0 - ISC
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the ISC license.
|
|
6
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/const _=R("Map",[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]]),K=R("Music",[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]]),G=e=>{switch(e){case"youtube":case"vimeo":case"dailymotion":case"wistia":case"loom":return i(M,{className:"h-3 w-3"});case"spotify":case"soundcloud":return i(K,{className:"h-3 w-3"});case"codepen":case"codesandbox":return i(I,{className:"h-3 w-3"});case"google-maps":return i(_,{className:"h-3 w-3"});default:return i(N,{className:"h-3 w-3"})}},J=({name:e,type:i})=>t("span",Object.assign({className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[10px] font-medium bg-muted text-muted-foreground"},{children:[G(i),e]})),Q=({onInsertUrl:e})=>{const[n,r]=s(""),[a,l]=s(!1),[o,c]=s(null),d=()=>{n.trim()&&(e(n.trim()),r(""),l(!1),c(null))};return t("div",Object.assign({className:"space-y-3"},{children:[t("div",Object.assign({className:"space-y-2"},{children:[i(j,{placeholder:"Paste a URL to embed (YouTube, Vimeo, Twitter, Spotify, etc.)",value:n,onChange:e=>(e=>{var t;if(r(e),e.trim()){const i=b(e.trim());if(l(i),i){const i=u(e.trim()),n=g().find(e=>e.type===i);c(null!==(t=null==n?void 0:n.name)&&void 0!==t?t:null)}else c(null)}else l(!1),c(null)})(e.target.value),onKeyDown:e=>{"Enter"===e.key&&n.trim()&&a&&(e.preventDefault(),d())},className:"h-10"}),n.trim()&&i("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:[G(u(n.trim())),o," detected"]})):i("span",Object.assign({className:"text-destructive"},{children:"Unsupported URL. Try YouTube, Vimeo, Twitter, Spotify, Figma, CodePen, etc."}))}))]})),i(x,Object.assign({className:"w-full",onClick:d,disabled:!n.trim()||!a},{children:a?`Embed ${o}`:"Embed content"}))]}))},X=()=>{const e=g().filter(e=>"unknown"!==e.type);return t("div",Object.assign({className:"mt-4 space-y-2"},{children:[i("p",Object.assign({className:"text-xs text-muted-foreground text-center"},{children:"Supported providers:"})),t("div",Object.assign({className:"flex flex-wrap gap-1.5 justify-center"},{children:[e.slice(0,8).map(e=>i(J,{name:e.name,type:e.type},e.type)),e.length>8&&t("span",Object.assign({className:"inline-flex items-center px-2 py-0.5 rounded-full text-[10px] font-medium bg-muted text-muted-foreground"},{children:["+",e.length-8," more"]}))]}))]}))},Z=({onInsertUrl:e,className:n,attributes:s,children:r})=>t("div",Object.assign({className:k("mt-2 relative rounded-lg border bg-background overflow-hidden",n)},s,{contentEditable:!1},{children:[t("div",Object.assign({className:"p-6"},{children:[t("div",Object.assign({className:"flex flex-col items-center gap-4"},{children:[i("div",Object.assign({className:"rounded-lg bg-muted p-3"},{children:i(N,{className:"h-6 w-6 text-muted-foreground"})})),t("div",Object.assign({className:"text-center"},{children:[i("p",Object.assign({className:"text-sm font-medium"},{children:"Embed content"})),i("p",Object.assign({className:"text-xs text-muted-foreground"},{children:"Paste a URL from supported platforms"}))]}))]})),i("div",Object.assign({className:"mt-6 max-w-md mx-auto"},{children:i(Q,{onInsertUrl:e})})),i(X,{})]})),r]})),ee=({referenceRef:e,elementProps:a,onUpdate:l,onReplace:o,onDelete:c,onCopy:d})=>{var m;const[h,p]=s(!1),u=a.provider&&a.provider.type,g="alignment"in a,{refs:b,floatingStyles:v}=U({placement:"top",strategy:"fixed",middleware:[V(8),Y(),$({padding:10})],whileElementsMounted:q});r(()=>{requestAnimationFrame(()=>{p(!0)})},[]),r(()=>{const t=e.current;t&&b.setReference(t)},[e,b]);return i("div",Object.assign({ref:b.setFloating,onMouseDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),className:k("pointer-events-auto","flex items-center gap-1 rounded-lg border bg-background/95 backdrop-blur-sm p-1 shadow-lg","transition-all duration-200 ease-out",h?"opacity-100 translate-y-0":"opacity-0 translate-y-2"),style:v},{children:t(S,Object.assign({delayDuration:0},{children:[g&&t("div",Object.assign({className:"flex items-center gap-0.5 border-r pr-1"},{children:[t(L,{children:[i(P,Object.assign({asChild:!0},{children:i(x,Object.assign({variant:"left"===a.alignment?"secondary":"ghost",size:"icon",className:"h-7 w-7",onClick:()=>l({alignment:"left"})},{children:i(O,{className:"h-4 w-4"})}))})),i(D,{children:"Align left"})]}),t(L,{children:[i(P,Object.assign({asChild:!0},{children:i(x,Object.assign({variant:"center"===a.alignment?"secondary":"ghost",size:"icon",className:"h-7 w-7",onClick:()=>l({alignment:"center"})},{children:i(C,{className:"h-4 w-4"})}))})),i(D,{children:"Align center"})]}),t(L,{children:[i(P,Object.assign({asChild:!0},{children:i(x,Object.assign({variant:"right"===a.alignment?"secondary":"ghost",size:"icon",className:"h-7 w-7",onClick:()=>l({alignment:"right"})},{children:i(E,{className:"h-4 w-4"})}))})),i(D,{children:"Align right"})]})]})),t(L,{children:[i(P,Object.assign({asChild:!0},{children:i(x,Object.assign({variant:"ghost",size:"icon",className:"h-7 w-7",onClick:o},{children:i(H,{className:"h-4 w-4"})}))})),i(D,{children:"Replace"})]}),u&&(null===(m=a.provider)||void 0===m?void 0:m.url)&&t(n,{children:[t(L,{children:[i(P,Object.assign({asChild:!0},{children:i(x,Object.assign({variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>{var e;d?d():(null===(e=a.provider)||void 0===e?void 0:e.url)&&A(a.provider.url)}},{children:i(W,{className:"h-4 w-4"})}))})),i(D,{children:"Copy URL"})]}),t(L,{children:[i(P,Object.assign({asChild:!0},{children:i(x,Object.assign({variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>{var e;(null===(e=a.provider)||void 0===e?void 0:e.url)&&window.open(a.provider.url,"_blank")}},{children:i(B,{className:"h-4 w-4"})}))})),i(D,{children:"Open in new tab"})]})]}),i(T,{orientation:"vertical",className:"h-4"}),t(L,{children:[i(P,Object.assign({asChild:!0},{children:i(x,Object.assign({variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:bg-destructive/10 hover:text-destructive",onClick:c},{children:i(F,{className:"h-4 w-4"})}))})),i(D,{children:"Delete"})]})]}))}))},te=({blockId:n,attributes:l,children:m,elementProps:h,onUpdate:p,onDelete:u,onReplace:g,pluginOptions:b})=>{var v,f,w,y,x;const[j,N]=s(h.sizes||{width:650,height:400}),{isElementSelected:O}=o(),C=c({blockId:n}),E=O&&C,R=a(null),I=d(),[M,U]=s(()=>{var e,t;const i=(null===(e=I.refElement)||void 0===e?void 0:e.getBoundingClientRect().width)||650,n=null!==(t=null==b?void 0:b.maxWidth)&&void 0!==t?t:i;return{maxWidth:"number"==typeof n?n:i,maxHeight:800}});r(()=>{const e=()=>{var e,t;const i=(null===(e=I.refElement)||void 0===e?void 0:e.getBoundingClientRect().width)||650,n=null!==(t=null==b?void 0:b.maxWidth)&&void 0!==t?t:i;U({maxWidth:"number"==typeof n?n:i,maxHeight:800})};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),n=i(e.width),s=i(e.height),r=i(t.width),a=i(t.height);if(n<=r&&s<=a)return{width:n,height:s};const l=n/r,o=s/a,c=Math.max(l,o),d=Math.round(n/c),m=Math.round(s/c);return{width:Math.min(d,r),height:Math.min(m,a)}},L=h.provider,P=null!==(v=null==L?void 0:L.embedUrl)&&void 0!==v?v:"",D={left:"justify-start",center:"justify-center",right:"justify-end"}[null!==(f=h.alignment)&&void 0!==f?f:"center"];return t("div",Object.assign({},l,{className:k("group/embed mt-2 relative transition-all w-full flex",D)},{children:[t("div",Object.assign({className:"relative",contentEditable:!1},{children:[i(z,Object.assign({ref:e=>{(null==e?void 0:e.resizableElement)&&e.resizableElement instanceof HTMLElement&&(R.current=e.resizableElement)},style:{position:"relative",outline:E?".125rem solid rgba(0, 0, 0, 0)":"none",outlineColor:E?"hsl(var(--primary))":"none"},size:{width:"number"==typeof j.width?j.width:parseInt(String(j.width),10),height:"number"==typeof j.height?j.height:parseInt(String(j.height),10)},onResize:(e,t,i)=>{const n=parseInt(i.style.width,10),s=parseInt(i.style.height,10),r=S({width:n,height:s},{width:M.maxWidth,height:M.maxHeight});N(r)},onResizeStop:(e,t,i)=>{const n=parseInt(i.style.width,10),s=parseInt(i.style.height,10),r=S({width:n,height:s},{width:M.maxWidth,height:M.maxHeight});p({sizes:r})},lockAspectRatio:!0,minWidth:200,minHeight:150,maxWidth:M.maxWidth,maxHeight:M.maxHeight,enableResizing:!!E&&{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:i("div",{className:"h-10 w-2 rounded-full border border-primary bg-primary shadow-sm"}),right:i("div",{className:"h-10 w-2 rounded-full border border-primary bg-primary shadow-sm"})},className:k("rounded-sm overflow-hidden")},{children:i("iframe",{title:null!==(y=null===(w=null==L?void 0:L.meta)||void 0===w?void 0:w.title)&&void 0!==y?y:`Embedded content from ${null!==(x=null==L?void 0:L.type)&&void 0!==x?x:"unknown"}`,src:P,width:"100%",height:"100%",frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",allowFullScreen:!0,className:"w-full h-full",style:{aspectRatio:`${j.width} / ${j.height}`}})})),E&&i(ee,{referenceRef:R,elementProps:h,onUpdate:p,onReplace:g,onDelete:u,onCopy:()=>e(void 0,void 0,void 0,function*(){if(null==L?void 0:L.url)try{const{default:e}=yield import("./chunks/index-e9d6a4a8.js").then(function(e){return e.i});e(L.url)}catch(e){}})})]})),m]}))},ie={embed:{render:({element:t,attributes:n,children:s,blockId:r})=>{var a;const o=d(),c=m("Embed"),u=l(e=>{h.updateElement(o,{blockId:r,type:"embed",props:Object.assign(Object.assign({},t.props),e)})},[o,r,t.props]),g=l(()=>e(void 0,void 0,void 0,function*(){const e=p.getBlockSlate(o,{id:r});if(!e)return;const i=h.getElementPath(o,{blockId:r,element:t});if(!i)return;const n=i?w.parent(e,i):void 0;n&&y.isElement(n[0])&&!w.isEditor(n[0])?h.deleteElement(o,{blockId:r,type:"embed",path:i}):p.deleteBlock(o,{blockId:r,focus:!0})}),[o,r,t]),b=l(()=>{h.updateElement(o,{blockId:r,type:"embed",props:Object.assign(Object.assign({},t.props),{provider:null})})},[o,r,t.props]),x=l(t=>e(void 0,void 0,void 0,function*(){var e;const i=v(t);if(i){const t=null!==(e=null==c?void 0:c.maxWidth)&&void 0!==e?e:650,{width:n,height:s}=f(i.type,t);u({provider:i,sizes:{width:n,height:s}})}}),[u,c]),j=t;return(null===(a=j.props)||void 0===a?void 0:a.provider)?i(te,Object.assign({blockId:r,elementId:t.id,onUpdate:u,onDelete:g,attributes:n,onReplace:b,elementProps:j.props,pluginOptions:c},{children:s})):i(Z,Object.assign({onInsertUrl:x,attributes:n},{children:s}))}}};
|
|
8
|
+
/**
|
|
9
|
+
* @license lucide-react v0.378.0 - ISC
|
|
10
|
+
*
|
|
11
|
+
* This source code is licensed under the ISC license.
|
|
12
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
13
|
+
*/export{ie as EmbedUI};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-element.d.ts","sourceRoot":"","sources":["../../../../src/file/elements/file/file-element.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,wBAAwB,EAA0B,MAAM,gBAAgB,CAAC;AAUvF,eAAO,MAAM,WAAW,+CAAgD,wBAAwB,4CA4G/F,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { FileType } from '@yoopta/file';
|
|
2
|
+
import { type LucideIcon } from 'lucide-react';
|
|
3
|
+
type FileIconProps = {
|
|
4
|
+
fileType: FileType;
|
|
5
|
+
className?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const FileIcon: ({ fileType, className }: FileIconProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare const getFileTypeStyles: (fileType: FileType) => {
|
|
9
|
+
icon: LucideIcon;
|
|
10
|
+
color: string;
|
|
11
|
+
bgColor: string;
|
|
12
|
+
};
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=file-icons.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-icons.d.ts","sourceRoot":"","sources":["../../../../src/file/elements/file/file-icons.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EASL,KAAK,UAAU,EAEhB,MAAM,cAAc,CAAC;AA6DtB,KAAK,aAAa,GAAG;IACnB,QAAQ,EAAE,QAAQ,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,QAAQ,4BAA6B,aAAa,4CAK9D,CAAC;AAEF,eAAO,MAAM,iBAAiB,aAAc,QAAQ;;WAtEe,MAAM;aAAW,MAAM;CAsEmB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { FileElementProps } from '../../types';
|
|
3
|
+
type FileInlineToolbarProps = {
|
|
4
|
+
referenceRef: React.MutableRefObject<HTMLElement | null>;
|
|
5
|
+
elementProps: FileElementProps;
|
|
6
|
+
onReplace: () => void;
|
|
7
|
+
onDelete: () => void;
|
|
8
|
+
onDownload?: () => void;
|
|
9
|
+
};
|
|
10
|
+
export declare const FileInlineToolbar: ({ referenceRef, elementProps, onReplace, onDelete, onDownload, }: FileInlineToolbarProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=file-inline-toolbar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-inline-toolbar.d.ts","sourceRoot":"","sources":["../../../../src/file/elements/file/file-inline-toolbar.tsx"],"names":[],"mappings":";AAQA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,KAAK,sBAAsB,GAAG;IAC5B,YAAY,EAAE,KAAK,CAAC,gBAAgB,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IACzD,YAAY,EAAE,gBAAgB,CAAC;IAC/B,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,iBAAiB,qEAM3B,sBAAsB,4CAuHxB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { PluginElementRenderProps } from '@yoopta/editor';
|
|
3
|
+
import type { FileUploadProgress } from '@yoopta/file';
|
|
4
|
+
type FilePlaceholderProps = {
|
|
5
|
+
onUpload: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
6
|
+
className?: string;
|
|
7
|
+
attributes: PluginElementRenderProps['attributes'];
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
progress: FileUploadProgress | null;
|
|
10
|
+
loading: boolean;
|
|
11
|
+
accept?: string;
|
|
12
|
+
};
|
|
13
|
+
export declare const FilePlaceholder: ({ onUpload, className, attributes, children, progress, loading, accept, }: FilePlaceholderProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=file-placeholder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-placeholder.d.ts","sourceRoot":"","sources":["../../../../src/file/elements/file/file-placeholder.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAMvD,KAAK,oBAAoB,GAAG;IAC1B,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IAC/D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,wBAAwB,CAAC,YAAY,CAAC,CAAC;IACnD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,QAAQ,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AA4DF,eAAO,MAAM,eAAe,8EAQzB,oBAAoB,4CAatB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { PluginElementRenderProps } from '@yoopta/editor';
|
|
3
|
+
import type { FileElementProps } from '../../types';
|
|
4
|
+
type Props = {
|
|
5
|
+
blockId: string;
|
|
6
|
+
onDelete: () => void;
|
|
7
|
+
onReplace: () => void;
|
|
8
|
+
attributes: PluginElementRenderProps['attributes'];
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
elementProps: FileElementProps;
|
|
11
|
+
};
|
|
12
|
+
export declare const FileRender: ({ blockId, attributes, children, elementProps, onDelete, onReplace }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=file-render.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-render.d.ts","sourceRoot":"","sources":["../../../../src/file/elements/file/file-render.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAS/D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,KAAK,KAAK,GAAG;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,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,gBAAgB,CAAC;CAChC,CAAC;AAEF,eAAO,MAAM,UAAU,yEAA0E,KAAK,4CAiErG,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/file/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM;;;;CAIlB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/file/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,IAAI,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAE7E,MAAM,MAAM,gBAAgB,GAAG,oBAAoB,CAAC"}
|
package/dist/file.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import{a as e}from"./chunks/_tslib-35bb891d.js";import{jsxs as t,jsx as a,Fragment as n}from"react/jsx-runtime";import{useRef as s,useState as r,useEffect as l,useCallback as i}from"react";import{useElementSelected as o,useBlockSelected as c,useYooptaEditor as d,useYooptaPluginOptions as p,Elements as m,Blocks as h}from"@yoopta/editor";import{getFileType as g,formatFileSize as u,useFileUpload as b,useFileDelete as k}from"@yoopta/file";import{Editor as f,Element as v}from"slate";import{B as y}from"./chunks/button-ecb0aed1.js";import{c as x}from"./chunks/utils-de9c4c2b.js";import{L as j,U as w,D as N}from"./chunks/upload-3b3687f2.js";import{c as O}from"./chunks/createLucideIcon-70ab5429.js";import{F as C}from"./chunks/file-text-f268c203.js";import{C as M}from"./chunks/code-734dab76.js";import{u as z,T as E,a as D,b as I,R as q,c as F}from"./chunks/tooltip-bc45d963.js";import{C as P,c as R}from"./chunks/index-e9d6a4a8.js";import{o as U,f as V,s as B,a as H}from"./chunks/index-842a4484.js";import{E as Z}from"./chunks/external-link-956d49c0.js";import{T as A}from"./chunks/trash-2-8f855002.js";import"react-dom";import"./chunks/index-8dc6d938.js";import"./chunks/index-91a5b8d5.js";import"./chunks/index-325e2e09.js";import"./chunks/index-7725d7e0.js";import"./chunks/index-70f4e709.js";
|
|
2
|
+
/**
|
|
3
|
+
* @license lucide-react v0.378.0 - ISC
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the ISC license.
|
|
6
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/const L=O("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]),S=O("FileAudio",[["path",{d:"M17.5 22h.5a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"rslqgf"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M2 19a2 2 0 1 1 4 0v1a2 2 0 1 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 1 1-4 0v-1a2 2 0 1 1 4 0",key:"9f7x3i"}]]),T=O("FileImage",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"10",cy:"12",r:"2",key:"737tya"}],["path",{d:"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22",key:"wt3hpn"}]]),$=O("FileSpreadsheet",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]]),_=O("FileVideo",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m10 11 5 3-5 3v-6Z",key:"7ntvm4"}]]),G=O("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]),J=O("Presentation",[["path",{d:"M2 3h20",key:"91anmk"}],["path",{d:"M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3",key:"2k9sn8"}],["path",{d:"m7 21 5-5 5 5",key:"bip4we"}]]),K=({progress:e})=>a("div",Object.assign({className:"absolute inset-0 z-20 flex flex-col items-center justify-center gap-4 bg-background/95 backdrop-blur-sm p-6 rounded-lg border"},{children:a("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:[a("span",Object.assign({className:"font-medium"},{children:"Uploading file..."})),t("span",Object.assign({className:"text-muted-foreground"},{children:[e.percentage,"%"]}))]})),a("div",Object.assign({className:"h-2 w-full overflow-hidden rounded-full bg-muted"},{children:a("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-muted-foreground"},{children:[t("span",{children:[(e.loaded/1024/1024).toFixed(2)," MB / ",(e.total/1024/1024).toFixed(2)," MB"]}),a(j,{className:"h-3.5 w-3.5 animate-spin"})]}))]}))}))})),Q=({onUpload:e,accept:n})=>{const r=s(null);return t("div",Object.assign({className:"flex flex-col items-center gap-3 py-6"},{children:[a("div",Object.assign({className:"rounded-lg bg-muted p-3"},{children:a(G,{className:"h-6 w-6 text-muted-foreground"})})),t("div",Object.assign({className:"text-center"},{children:[a("p",Object.assign({className:"text-sm font-medium"},{children:"Upload a file"})),a("p",Object.assign({className:"text-xs text-muted-foreground"},{children:"Click to select a file"}))]})),t(y,Object.assign({onClick:()=>{var e;return null===(e=r.current)||void 0===e?void 0:e.click()},variant:"default",className:"gap-2"},{children:[a(w,{className:"h-4 w-4"}),"Choose file"]})),a("input",{ref:r,type:"file",accept:n,onChange:e,className:"hidden"})]}))},W=({onUpload:e,className:n,attributes:s,children:r,progress:l,loading:i,accept:o})=>{const c=i&&l;return t("div",Object.assign({className:x("mt-2 relative rounded-lg border bg-background overflow-hidden",n)},s,{contentEditable:!1},{children:[a(Q,{onUpload:e,accept:o}),c&&l&&a(K,{progress:l}),r]}))},X={pdf:{icon:C,color:"text-red-600 dark:text-red-400",bgColor:"bg-red-100 dark:bg-red-900/30"},document:{icon:C,color:"text-blue-600 dark:text-blue-400",bgColor:"bg-blue-100 dark:bg-blue-900/30"},spreadsheet:{icon:$,color:"text-green-600 dark:text-green-400",bgColor:"bg-green-100 dark:bg-green-900/30"},presentation:{icon:J,color:"text-orange-600 dark:text-orange-400",bgColor:"bg-orange-100 dark:bg-orange-900/30"},image:{icon:T,color:"text-purple-600 dark:text-purple-400",bgColor:"bg-purple-100 dark:bg-purple-900/30"},video:{icon:_,color:"text-pink-600 dark:text-pink-400",bgColor:"bg-pink-100 dark:bg-pink-900/30"},audio:{icon:S,color:"text-yellow-600 dark:text-yellow-400",bgColor:"bg-yellow-100 dark:bg-yellow-900/30"},archive:{icon:L,color:"text-amber-600 dark:text-amber-400",bgColor:"bg-amber-100 dark:bg-amber-900/30"},code:{icon:M,color:"text-cyan-600 dark:text-cyan-400",bgColor:"bg-cyan-100 dark:bg-cyan-900/30"},text:{icon:C,color:"text-gray-600 dark:text-gray-400",bgColor:"bg-gray-100 dark:bg-gray-800/50"},unknown:{icon:G,color:"text-muted-foreground",bgColor:"bg-muted"}},Y=({fileType:e,className:t})=>{var n;const s=(null!==(n=X[e])&&void 0!==n?n:X.unknown).icon;return a(s,{className:t})},ee=({referenceRef:e,elementProps:i,onReplace:o,onDelete:c,onDownload:d})=>{const[p,m]=r(!1),h=s(null),{floatingStyles:g}=z({placement:"top-end",strategy:"fixed",middleware:[U(8),V({fallbackPlacements:["bottom","top"],padding:10}),B({padding:10})],whileElementsMounted:H,elements:{reference:e.current,floating:h.current}});l(()=>{requestAnimationFrame(()=>{m(!0)})},[]);return a("div",Object.assign({ref:h,onMouseDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),className:x("pointer-events-auto z-50","flex items-center gap-1 rounded-lg border bg-background/95 backdrop-blur-sm p-1 shadow-lg","transition-all duration-200 ease-out",p?"opacity-100 translate-y-0":"opacity-0 translate-y-2"),style:g},{children:t(E,Object.assign({delayDuration:0},{children:[t(D,{children:[a(I,Object.assign({asChild:!0},{children:a(y,Object.assign({variant:"ghost",size:"icon",className:"h-7 w-7",onClick:o},{children:a(q,{className:"h-4 w-4"})}))})),a(F,{children:"Replace"})]}),i.src&&t(n,{children:[t(D,{children:[a(I,Object.assign({asChild:!0},{children:a(y,Object.assign({variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>{var e;if(d)d();else if(i.src){const t=document.createElement("a");t.href=i.src,t.download=null!==(e=i.name)&&void 0!==e?e:`file-${Date.now()}`,t.click()}}},{children:a(N,{className:"h-4 w-4"})}))})),a(F,{children:"Download"})]}),t(D,{children:[a(I,Object.assign({asChild:!0},{children:a(y,Object.assign({variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>{i.src&&R(i.src)}},{children:a(P,{className:"h-4 w-4"})}))})),a(F,{children:"Copy URL"})]}),t(D,{children:[a(I,Object.assign({asChild:!0},{children:a(y,Object.assign({variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>{i.src&&window.open(i.src,"_blank")}},{children:a(Z,{className:"h-4 w-4"})}))})),a(F,{children:"Open in new tab"})]})]}),t(D,{children:[a(I,Object.assign({asChild:!0},{children:a(y,Object.assign({variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:bg-destructive/10 hover:text-destructive",onClick:c},{children:a(A,{className:"h-4 w-4"})}))})),a(F,{children:"Delete"})]})]}))}))},te=({blockId:e,attributes:n,children:r,elementProps:l,onDelete:i,onReplace:d})=>{const{isElementSelected:p}=o(),m=c({blockId:e}),h=p&&m,b=s(null),{name:k,format:f,size:v,src:j}=l,w=f?`${k}.${f}`:null!=k?k:"Untitled file",O=g(w),C=(e=>{var t;return null!==(t=X[e])&&void 0!==t?t:X.unknown})(O),M=()=>{if(!j)return;const e=document.createElement("a");e.href=j,e.download=w,e.click()};return t("div",Object.assign({},n,{className:"group/file mt-2 relative transition-all w-full"},{children:[t("div",Object.assign({className:"relative",contentEditable:!1},{children:[t("div",Object.assign({ref:b,className:x("flex items-center gap-3 p-3 rounded-lg border bg-card transition-all","hover:bg-accent/50",h&&"ring-2 ring-primary ring-offset-2")},{children:[a("div",Object.assign({className:x("flex-shrink-0 rounded-lg p-2.5",C.bgColor)},{children:a(Y,{fileType:O,className:x("h-5 w-5",C.color)})})),t("div",Object.assign({className:"flex-1 min-w-0"},{children:[a("p",Object.assign({className:"text-sm font-medium truncate"},{children:w})),a("p",Object.assign({className:"text-xs text-muted-foreground"},{children:u(v)}))]})),j&&a(y,Object.assign({variant:"ghost",size:"icon",className:"flex-shrink-0 h-8 w-8 opacity-0 group-hover/file:opacity-100 transition-opacity",onClick:M},{children:a(N,{className:"h-4 w-4"})}))]})),h&&a(ee,{referenceRef:b,elementProps:l,onReplace:d,onDelete:i,onDownload:M})]})),r]}))},ae={file:{render:({element:t,attributes:n,children:s,blockId:r})=>{const l=d(),o=p("File"),{upload:c,progress:g,loading:u}=b(o.upload),{deleteFile:y}=k(o.delete),x=i(e=>{m.updateElement(l,{blockId:r,type:"file",props:Object.assign(Object.assign({},t.props),e)})},[l,r,t.props]),j=i(()=>e(void 0,void 0,void 0,function*(){yield y(t);const e=h.getBlockSlate(l,{id:r});if(!e)return;const a=m.getElementPath(l,{blockId:r,element:t});if(!a)return;const n=a?f.parent(e,a):void 0;n&&v.isElement(n[0])&&!f.isEditor(n[0])?m.deleteElement(l,{blockId:r,type:"file",path:a}):h.deleteBlock(l,{blockId:r,focus:!0})}),[l,r,t,y]),w=i(()=>{m.updateElement(l,{blockId:r,type:"file",props:Object.assign(Object.assign({},t.props),{id:null,src:null,name:null,size:null,format:null})})},[l,r,t.props]),N=i(t=>e(void 0,void 0,void 0,function*(){var e,a,n;const s=null===(e=t.target.files)||void 0===e?void 0:e[0];if(!s)return;const r=yield c(s);let l=null!==(a=r.name)&&void 0!==a?a:s.name,i=null;const o=l.lastIndexOf(".");o>0&&(i=l.slice(o+1),l=l.slice(0,o)),x({id:r.id,src:r.url,name:l,size:null!==(n=r.size)&&void 0!==n?n:s.size,format:i})}),[c,x]);return t.props.src?a(te,Object.assign({blockId:r,onDelete:j,attributes:n,onReplace:w,elementProps:t.props},{children:s})):a(W,Object.assign({onUpload:N,progress:g,loading:u,accept:o.accept,attributes:n},{children:s}))}}};
|
|
8
|
+
/**
|
|
9
|
+
* @license lucide-react v0.378.0 - ISC
|
|
10
|
+
*
|
|
11
|
+
* This source code is licensed under the ISC license.
|
|
12
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
13
|
+
*/export{ae as FileUI};
|
package/dist/headings.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";const t={HeadingOne:{"heading-one":{render:t=>{const{attributes:r,children:n,element:i}=t;return e("h1",Object.assign({id:i.id,draggable:!1},r,{className:"scroll-m-20 text-4xl font-extrabold tracking-tight lg:text-5xl"},{children:n}))}}},HeadingTwo:{"heading-two":{render:t=>{const{attributes:r,children:n,element:i}=t;return e("h2",Object.assign({id:i.id,draggable:!1},r,{className:"scroll-m-20 border-b pb-2 text-3xl font-semibold tracking-tight first:mt-0"},{children:n}))}}},HeadingThree:{"heading-three":{render:t=>{const{attributes:r,children:n,element:i}=t;return e("h3",Object.assign({id:i.id,draggable:!1},r,{className:"mt-4 scroll-m-20 text-2xl font-semibold tracking-tight"},{children:n}))}}}};export{t as HeadingsUI};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image-placeholder.d.ts","sourceRoot":"","sources":["../../../../src/image/elements/image/image-placeholder.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"image-placeholder.d.ts","sourceRoot":"","sources":["../../../../src/image/elements/image/image-placeholder.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAU7E,KAAK,qBAAqB,GAAG;IAC3B,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IAC/D,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,oBAAoB,CAAC,EAAE,MAAM,IAAI,CAAC;IAClC,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,wBAAwB,CAAC,YAAY,CAAC,CAAC;IACnD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,OAAO,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACnC,QAAQ,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACrC,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AA8RF,eAAO,MAAM,gBAAgB,kIAW1B,qBAAqB,4CA6BvB,CAAC"}
|
|
@@ -13,6 +13,6 @@ type Props = {
|
|
|
13
13
|
elementProps: ImageElementProps;
|
|
14
14
|
pluginOptions?: ImagePluginOptions;
|
|
15
15
|
};
|
|
16
|
-
export declare const ImageRender: ({ blockId,
|
|
16
|
+
export declare const ImageRender: ({ blockId, attributes, children, elementProps, onUpdate, onDelete, onReplace, pluginOptions, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
17
17
|
export {};
|
|
18
18
|
//# sourceMappingURL=image-render.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image-render.d.ts","sourceRoot":"","sources":["../../../../src/image/elements/image/image-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,
|
|
1
|
+
{"version":3,"file":"image-render.d.ts","sourceRoot":"","sources":["../../../../src/image/elements/image/image-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,4CA8PP,CAAC"}
|
package/dist/image.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{_ as e,a as t}from"./chunks/_tslib-35bb891d.js";import{jsx as n,jsxs as i,Fragment as a}from"react/jsx-runtime";import*as s from"react";import{useRef as r,useState as o,useEffect as l,useCallback as c}from"react";import{useElementSelected as d,useBlockSelected as m,useYooptaEditor as h,useYooptaPluginOptions as u,Elements as g,Blocks as p}from"@yoopta/editor";import{useImageUpload as f,useImageDelete as b,useImagePreview as v}from"@yoopta/image";import{Editor as w,Element as x}from"slate";import{B as j}from"./chunks/button-ecb0aed1.js";import{a as y,T as N,c as O,b as k}from"./chunks/tabs-eeea28d9.js";import{I as S}from"./chunks/input-2708c7f4.js";import{c as I}from"./chunks/utils-de9c4c2b.js";import{a as C,b as R,c as E,T as D,u as z,R as P}from"./chunks/tooltip-bc45d963.js";import{L as U,U as M,D as A}from"./chunks/upload-3b3687f2.js";import{L as H,A as _,a as F,b as L,R as B}from"./chunks/index-3b428d14.js";import{S as K}from"./chunks/sparkles-c8608d1b.js";import{c as V}from"./chunks/createLucideIcon-70ab5429.js";import{C as W,c as T}from"./chunks/index-e9d6a4a8.js";import{L as $}from"./chunks/label-a0e6fde2.js";import{P as Y,a as X,b as q}from"./chunks/popover-53c769ba.js";import{u as G,S as J,a as Q,b as Z,c as ee,d as te,e as ne,f as ie}from"./chunks/select-c547d76b.js";import{S as ae}from"./chunks/separator-7be92037.js";import{c as se}from"./chunks/index-056e5c06.js";import{c as re,a as oe,P as le}from"./chunks/index-8dc6d938.js";import{u as ce}from"./chunks/index-91a5b8d5.js";import{u as de}from"./chunks/index-7725d7e0.js";import{u as me}from"./chunks/index-13505606.js";import{u as he,o as ue,f as ge,s as pe,a as fe}from"./chunks/index-842a4484.js";import{c as be}from"./chunks/index-aaeb33b0.js";import{T as ve}from"./chunks/trash-2-8f855002.js";import"./chunks/index-b273f426.js";import"./chunks/index-325e2e09.js";import"./chunks/index-70f4e709.js";import"react-dom";import"./chunks/Combination-ee85502b.js";import"./chunks/chevron-down-abe5f871.js";import"./chunks/check-9adcfdfa.js";import"./chunks/chevron-up-5b4801a9.js";
|
|
2
|
+
/**
|
|
3
|
+
* @license lucide-react v0.378.0 - ISC
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the ISC license.
|
|
6
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/const we=V("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]),xe=({onInsertFromUnsplash:e})=>n(y,Object.assign({value:"unsplash",className:"mt-4"},{children:i("div",Object.assign({className:"flex flex-col items-center gap-3 py-6"},{children:[n("div",Object.assign({className:"rounded-lg bg-muted p-3"},{children:n("svg",Object.assign({className:"h-6 w-6",viewBox:"0 0 32 32",fill:"currentColor"},{children:n("path",{d:"M10 9V0h12v9H10zm12 5h10v18H0V14h10v9h12v-9z"})}))})),i("div",Object.assign({className:"text-center"},{children:[n("p",Object.assign({className:"text-sm font-medium"},{children:"Browse free photos"})),n("p",Object.assign({className:"text-xs text-muted-foreground"},{children:"Powered by Unsplash"}))]})),n(j,Object.assign({onClick:e},{children:"Browse photos"}))]}))})),je=({preview:e})=>n("div",Object.assign({className:"absolute inset-0 overflow-hidden",style:{width:e.width,height:e.height}},{children:n("img",{src:e.url,alt:"Preview",className:"h-full w-full object-cover object-center",style:{width:e.width,height:e.height},draggable:!1})})),ye=({progress:e})=>n("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:n("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:[n("span",Object.assign({className:"font-medium text-white"},{children:"Uploading..."})),i("span",Object.assign({className:"text-white/80"},{children:[e.percentage,"%"]}))]})),n("div",Object.assign({className:"h-2 w-full overflow-hidden rounded-full bg-white/20"},{children:n("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"]}),n(U,{className:"h-3.5 w-3.5 animate-spin"})]}))]}))}))})),Ne=({onUpload:e,hasPreview:t})=>{const a=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:[n("p",Object.assign({className:"text-sm font-medium text-white"},{children:"Image preview"})),n("p",Object.assign({className:"text-xs text-white/80"},{children:"Uploading your image..."}))]})),n("input",{ref:a,type:"file",accept:"image/*",onChange:e,className:"hidden"})]}):Object.assign({className:"flex flex-col items-center gap-3 py-6"},{children:[n("div",Object.assign({className:"rounded-lg bg-muted p-3"},{children:n(we,{className:"h-6 w-6 text-muted-foreground"})})),i("div",Object.assign({className:"text-center"},{children:[n("p",Object.assign({className:"text-sm font-medium"},{children:"Upload an image"})),n("p",Object.assign({className:"text-xs text-muted-foreground"},{children:"Click or drag and drop"}))]})),n(j,Object.assign({onClick:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.click()}},{children:"Choose file"})),n("input",{ref:a,type:"file",accept:"image/*",onChange:e,className:"hidden"})]}))},Oe=({onInsertUrl:e})=>{const[t,a]=o(""),s=()=>{t.trim()&&(e(t.trim()),a(""))};return i("div",Object.assign({className:"mt-4 space-y-3"},{children:[n(S,{placeholder:"Paste image URL...",value:t,onChange:e=>a(e.target.value),onKeyDown:e=>{"Enter"===e.key&&t.trim()&&s()}}),n(j,Object.assign({className:"w-full",onClick:s,disabled:!t.trim()},{children:"Embed image"}))]}))},ke=({onInsertFromAI:e})=>{const[t,s]=o(""),[r,l]=o(!1),c=()=>{t.trim()&&!r&&(l(!0),e(t.trim()),l(!1),s(""))};return i("div",Object.assign({className:"mt-4 space-y-3"},{children:[i("div",Object.assign({className:"space-y-2"},{children:[n(S,{placeholder:"Describe the image...",value:t,onChange:e=>s(e.target.value),onKeyDown:e=>{"Enter"===e.key&&c()},disabled:r}),n("p",Object.assign({className:"text-xs text-muted-foreground"},{children:'Example: "A sunset over mountains with dramatic clouds”'}))]})),n(j,Object.assign({className:"w-full gap-2",onClick:c,disabled:!t.trim()||r},{children:i(a,r?{children:[n(U,{className:"h-4 w-4 animate-spin"}),"Generating..."]}:{children:[n(K,{className:"h-4 w-4"}),"Generate image"]})}))]}))},Se=({onUpload:e,onInsertUrl:t,onInsertFromUnsplash:a,onInsertFromAI:s,hasPreview:r})=>n("div",Object.assign({className:I("relative p-4",r&&"min-h-[300px] flex flex-col")},{children:i(N,Object.assign({defaultValue:"upload",className:"w-full"},{children:[i(O,Object.assign({className:I("grid w-full grid-cols-4",r&&"bg-background/80 backdrop-blur-sm")},{children:[i(k,Object.assign({value:"upload",className:"gap-1.5"},{children:[n(M,{className:"h-3.5 w-3.5"}),"Upload"]})),i(C,{children:[n(R,Object.assign({asChild:!0},{children:i(k,Object.assign({value:"link",disabled:!0,className:"gap-1.5"},{children:[n(H,{className:"h-3.5 w-3.5"}),"Link"]}))})),n(E,{children:"Link is not available yet"})]}),a&&i(C,{children:[n(R,Object.assign({asChild:!0},{children:i(k,Object.assign({value:"unsplash",disabled:!0,className:"gap-1.5"},{children:[n("svg",Object.assign({className:"h-3.5 w-3.5",viewBox:"0 0 32 32",fill:"currentColor"},{children:n("path",{d:"M10 9V0h12v9H10zm12 5h10v18H0V14h10v9h12v-9z"})})),"Unsplash"]}))})),n(E,{children:"Unsplash is not available yet"})]}),s&&i(C,{children:[n(R,Object.assign({asChild:!0},{children:i(k,Object.assign({value:"ai",disabled:!0,className:"gap-1.5"},{children:[n(K,{className:"h-3.5 w-3.5"}),"AI"]}))})),n(E,{children:"AI is not available yet"})]})]})),n(y,Object.assign({value:"upload",className:"mt-4"},{children:n(Ne,{onUpload:e,hasPreview:r})})),n(y,Object.assign({value:"link",d:!0},{children:n(Oe,{onInsertUrl:t})})),a&&n(xe,{onInsertFromUnsplash:a}),s&&n(y,Object.assign({value:"ai"},{children:n(ke,{onInsertFromAI:s})}))]}))})),Ie=({onUpload:e,onInsertUrl:t,onInsertFromUnsplash:a,onInsertFromAI:s,className:r,attributes:o,children:l,preview:c,progress:d,loading:m})=>{const h=null!==c&&!!c.url,u=m&&d;return i("div",Object.assign({className:I("mt-2 relative rounded-lg border bg-background overflow-hidden",h&&"min-h-[300px]",r)},o,{contentEditable:!1},{children:[h&&n(je,{preview:c}),!h&&n(Se,{onUpload:e,onInsertUrl:t,onInsertFromUnsplash:a,onInsertFromAI:s,hasPreview:h}),u&&d&&n(ye,{progress:d}),l]}))};var Ce=["PageUp","PageDown"],Re=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Ee={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},De="Slider",[ze,Pe,Ue]=be(De),[Me,Ae]=re(De,[Ue]),[He,_e]=Me(De),Fe=s.forwardRef((e,t)=>{const{name:i,min:a=0,max:r=100,step:o=1,orientation:l="horizontal",disabled:c=!1,minStepsBetweenThumbs:d=0,defaultValue:m=[a],value:h,onValueChange:u=()=>{},onValueCommit:g=()=>{},inverted:p=!1,form:f,...b}=e,v=s.useRef(new Set),w=s.useRef(0),x="horizontal"===l?Ke:Ve,[j=[],y]=de({prop:h,defaultProp:m,onChange:e=>{const t=[...v.current];t[w.current]?.focus(),u(e)}}),N=s.useRef(j);function O(e,t,{commit:n}={commit:!1}){const i=function(e){return(String(e).split(".")[1]||"").length}(o),s=function(e,t){const n=Math.pow(10,t);return Math.round(e*n)/n}(Math.round((e-a)/o)*o+a,i),l=se(s,[a,r]);y((e=[])=>{const i=function(e=[],t,n){const i=[...e];return i[n]=t,i.sort((e,t)=>e-t)}(e,l,t);if(function(e,t){if(t>0){const n=function(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}(e);return Math.min(...n)>=t}return!0}(i,d*o)){w.current=i.indexOf(l);const t=String(i)!==String(e);return t&&n&&g(i),t?i:e}return e})}return n(He,{scope:e.__scopeSlider,name:i,disabled:c,min:a,max:r,valueIndexToChangeRef:w,thumbs:v.current,values:j,orientation:l,form:f,children:n(ze.Provider,{scope:e.__scopeSlider,children:n(ze.Slot,{scope:e.__scopeSlider,children:n(x,{"aria-disabled":c,"data-disabled":c?"":void 0,...b,ref:t,onPointerDown:oe(b.onPointerDown,()=>{c||(N.current=j)}),min:a,max:r,inverted:p,onSlideStart:c?void 0:function(e){const t=function(e,t){if(1===e.length)return 0;const n=e.map(e=>Math.abs(e-t)),i=Math.min(...n);return n.indexOf(i)}(j,e);O(e,t)},onSlideMove:c?void 0:function(e){O(e,w.current)},onSlideEnd:c?void 0:function(){const e=N.current[w.current];j[w.current]!==e&&g(j)},onHomeKeyDown:()=>!c&&O(a,0,{commit:!0}),onEndKeyDown:()=>!c&&O(r,j.length-1,{commit:!0}),onStepKeyDown:({event:e,direction:t})=>{if(!c){const n=Ce.includes(e.key)||e.shiftKey&&Re.includes(e.key)?10:1,i=w.current;O(j[i]+o*n*t,i,{commit:!0})}}})})})})});Fe.displayName=De;var[Le,Be]=Me(De,{startEdge:"left",endEdge:"right",size:"width",direction:1}),Ke=s.forwardRef((e,t)=>{const{min:i,max:a,dir:r,inverted:o,onSlideStart:l,onSlideMove:c,onSlideEnd:d,onStepKeyDown:m,...h}=e,[u,g]=s.useState(null),p=ce(t,e=>g(e)),f=s.useRef(void 0),b=me(r),v="ltr"===b,w=v&&!o||!v&&o;function x(e){const t=f.current||u.getBoundingClientRect(),n=et([0,t.width],w?[i,a]:[a,i]);return f.current=t,n(e-t.left)}return n(Le,{scope:e.__scopeSlider,startEdge:w?"left":"right",endEdge:w?"right":"left",direction:w?1:-1,size:"width",children:n(We,{dir:b,"data-orientation":"horizontal",...h,ref:p,style:{...h.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:e=>{const t=x(e.clientX);l?.(t)},onSlideMove:e=>{const t=x(e.clientX);c?.(t)},onSlideEnd:()=>{f.current=void 0,d?.()},onStepKeyDown:e=>{const t=Ee[w?"from-left":"from-right"].includes(e.key);m?.({event:e,direction:t?-1:1})}})})}),Ve=s.forwardRef((e,t)=>{const{min:i,max:a,inverted:r,onSlideStart:o,onSlideMove:l,onSlideEnd:c,onStepKeyDown:d,...m}=e,h=s.useRef(null),u=ce(t,h),g=s.useRef(void 0),p=!r;function f(e){const t=g.current||h.current.getBoundingClientRect(),n=et([0,t.height],p?[a,i]:[i,a]);return g.current=t,n(e-t.top)}return n(Le,{scope:e.__scopeSlider,startEdge:p?"bottom":"top",endEdge:p?"top":"bottom",size:"height",direction:p?1:-1,children:n(We,{"data-orientation":"vertical",...m,ref:u,style:{...m.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:e=>{const t=f(e.clientY);o?.(t)},onSlideMove:e=>{const t=f(e.clientY);l?.(t)},onSlideEnd:()=>{g.current=void 0,c?.()},onStepKeyDown:e=>{const t=Ee[p?"from-bottom":"from-top"].includes(e.key);d?.({event:e,direction:t?-1:1})}})})}),We=s.forwardRef((e,t)=>{const{__scopeSlider:i,onSlideStart:a,onSlideMove:s,onSlideEnd:r,onHomeKeyDown:o,onEndKeyDown:l,onStepKeyDown:c,...d}=e,m=_e(De,i);return n(le.span,{...d,ref:t,onKeyDown:oe(e.onKeyDown,e=>{"Home"===e.key?(o(e),e.preventDefault()):"End"===e.key?(l(e),e.preventDefault()):Ce.concat(Re).includes(e.key)&&(c(e),e.preventDefault())}),onPointerDown:oe(e.onPointerDown,e=>{const t=e.target;t.setPointerCapture(e.pointerId),e.preventDefault(),m.thumbs.has(t)?t.focus():a(e)}),onPointerMove:oe(e.onPointerMove,e=>{e.target.hasPointerCapture(e.pointerId)&&s(e)}),onPointerUp:oe(e.onPointerUp,e=>{const t=e.target;t.hasPointerCapture(e.pointerId)&&(t.releasePointerCapture(e.pointerId),r(e))})})}),Te="SliderTrack",$e=s.forwardRef((e,t)=>{const{__scopeSlider:i,...a}=e,s=_e(Te,i);return n(le.span,{"data-disabled":s.disabled?"":void 0,"data-orientation":s.orientation,...a,ref:t})});$e.displayName=Te;var Ye="SliderRange",Xe=s.forwardRef((e,t)=>{const{__scopeSlider:i,...a}=e,r=_e(Ye,i),o=Be(Ye,i),l=s.useRef(null),c=ce(t,l),d=r.values.length,m=r.values.map(e=>Ze(e,r.min,r.max)),h=d>1?Math.min(...m):0,u=100-Math.max(...m);return n(le.span,{"data-orientation":r.orientation,"data-disabled":r.disabled?"":void 0,...a,ref:c,style:{...e.style,[o.startEdge]:h+"%",[o.endEdge]:u+"%"}})});Xe.displayName=Ye;var qe="SliderThumb",Ge=s.forwardRef((e,t)=>{const i=Pe(e.__scopeSlider),[a,r]=s.useState(null),o=ce(t,e=>r(e)),l=s.useMemo(()=>a?i().findIndex(e=>e.ref.current===a):-1,[i,a]);return n(Je,{...e,ref:o,index:l})}),Je=s.forwardRef((e,t)=>{const{__scopeSlider:a,index:r,name:o,...l}=e,c=_e(qe,a),d=Be(qe,a),[m,h]=s.useState(null),u=ce(t,e=>h(e)),g=!m||(c.form||!!m.closest("form")),p=he(m),f=c.values[r],b=void 0===f?0:Ze(f,c.min,c.max),v=function(e,t){return t>2?`Value ${e+1} of ${t}`:2===t?["Minimum","Maximum"][e]:void 0}(r,c.values.length),w=p?.[d.size],x=w?function(e,t,n){const i=e/2,a=et([0,50],[0,i]);return(i-a(t)*n)*n}(w,b,d.direction):0;return s.useEffect(()=>{if(m)return c.thumbs.add(m),()=>{c.thumbs.delete(m)}},[m,c.thumbs]),i("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[d.startEdge]:`calc(${b}% + ${x}px)`},children:[n(ze.ItemSlot,{scope:e.__scopeSlider,children:n(le.span,{role:"slider","aria-label":e["aria-label"]||v,"aria-valuemin":c.min,"aria-valuenow":f,"aria-valuemax":c.max,"aria-orientation":c.orientation,"data-orientation":c.orientation,"data-disabled":c.disabled?"":void 0,tabIndex:c.disabled?void 0:0,...l,ref:u,style:void 0===f?{display:"none"}:e.style,onFocus:oe(e.onFocus,()=>{c.valueIndexToChangeRef.current=r})})}),g&&n(Qe,{name:o??(c.name?c.name+(c.values.length>1?"[]":""):void 0),form:c.form,value:f},r)]})});Ge.displayName=qe;var Qe=s.forwardRef(({__scopeSlider:e,value:t,...i},a)=>{const r=s.useRef(null),o=ce(r,a),l=G(t);return s.useEffect(()=>{const e=r.current;if(!e)return;const n=window.HTMLInputElement.prototype,i=Object.getOwnPropertyDescriptor(n,"value").set;if(l!==t&&i){const n=new Event("input",{bubbles:!0});i.call(e,t),e.dispatchEvent(n)}},[l,t]),n(le.input,{style:{display:"none"},...i,ref:o,defaultValue:t})});function Ze(e,t,n){return se(100/(n-t)*(e-t),[0,100])}function et(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const i=(t[1]-t[0])/(e[1]-e[0]);return t[0]+i*(n-e[0])}}Qe.displayName="RadioBubbleInput";var tt=Fe,nt=$e,it=Xe,at=Ge;const st=t=>{var{className:a,defaultValue:r,value:o,min:l=0,max:c=100}=t,d=e(t,["className","defaultValue","value","min","max"]);const m=s.useMemo(()=>Array.isArray(o)?o:Array.isArray(r)?r:[l,c],[o,r,l,c]);return i(tt,Object.assign({"data-slot":"slider",defaultValue:r,value:o,min:l,max:c,className:I("relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col",a)},d,{children:[n(nt,Object.assign({"data-slot":"slider-track",className:I("bg-muted relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5")},{children:n(it,{"data-slot":"slider-range",className:I("bg-primary absolute data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full")})})),Array.from({length:m.length},(e,t)=>n(at,{"data-slot":"slider-thumb",className:"border-primary ring-ring/50 block size-4 shrink-0 rounded-full border bg-white shadow-sm transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50"},t))]}))},rt={contain:{label:"Contain",description:"Fit within bounds"},cover:{label:"Cover",description:"Fill and crop"},fill:{label:"Fill",description:"Stretch to fit"}},ot=({fit:e,alt:t,borderRadius:a,onUpdate:s})=>{var r,l,c,d,m,h,u,g;const[p,f]=o(t),[b,v]=o(!1);return i(Y,Object.assign({open:b,onOpenChange:v},{children:[n(D,{children:i(C,{children:[n(R,Object.assign({asChild:!0},{children:n(X,Object.assign({asChild:!0},{children:n(j,Object.assign({variant:b?"secondary":"ghost",size:"icon",className:"h-7 w-7"},{children:n(J,{className:"h-4 w-4"})}))}))})),n(E,{children:"Settings"})]})}),n(q,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:[n("h4",Object.assign({className:"font-semibold"},{children:"Image settings"})),n("p",Object.assign({className:"text-xs text-muted-foreground"},{children:"Customize how the image appears"}))]}),n(ae,{}),i("div",Object.assign({className:"space-y-1"},{children:[n($,Object.assign({htmlFor:"alt-text",className:"text-sm font-medium"},{children:"Alt text"})),n(S,{id:"alt-text",value:p,onChange:e=>f(e.target.value),onBlur:()=>s({alt:p}),placeholder:"Describe this image...",className:"h-9"}),n("p",Object.assign({className:"text-xs text-muted-foreground"},{children:"Important for accessibility and SEO"}))]})),i("div",Object.assign({className:"space-y-1"},{children:[n($,Object.assign({htmlFor:"object-fit",className:"text-sm font-medium"},{children:"How image fits"})),i(Q,Object.assign({value:e,onValueChange:e=>s({fit:e})},{children:[n(Z,Object.assign({id:"object-fit",className:"h-9 w-full"},{children:n(ee,Object.assign({placeholder:"Select how image fits"},{children:i("div",Object.assign({className:"flex items-center gap-2"},{children:[n("div",Object.assign({className:"font-medium"},{children:null===(r=rt[e])||void 0===r?void 0:r.label})),n("div",Object.assign({className:"text-xs text-muted-foreground"},{children:null===(l=rt[e])||void 0===l?void 0:l.description}))]}))}))})),n(te,{children:i(ne,{children:[n(ie,Object.assign({value:"contain",className:"cursor-pointer"},{children:i("div",Object.assign({className:"flex items-center gap-2"},{children:[n("div",Object.assign({className:"flex h-8 w-8 shrink-0 items-center justify-center rounded border"},{children:n("div",{className:"h-4 w-3 rounded bg-primary"})})),i("div",Object.assign({className:"flex-1"},{children:[n("div",Object.assign({className:"font-medium"},{children:null===(c=rt.contain)||void 0===c?void 0:c.label})),n("div",Object.assign({className:"text-xs text-muted-foreground"},{children:null===(d=rt.contain)||void 0===d?void 0:d.description}))]}))]}))})),n(ie,Object.assign({value:"cover",className:"cursor-pointer"},{children:i("div",Object.assign({className:"flex items-center gap-2"},{children:[n("div",Object.assign({className:"flex h-8 w-8 shrink-0 items-center justify-center rounded border"},{children:n("div",{className:"h-8 w-6 rounded bg-primary"})})),i("div",Object.assign({className:"flex-1"},{children:[n("div",Object.assign({className:"font-medium"},{children:null===(m=rt.cover)||void 0===m?void 0:m.label})),n("div",Object.assign({className:"text-xs text-muted-foreground"},{children:null===(h=rt.cover)||void 0===h?void 0:h.description}))]}))]}))})),n(ie,Object.assign({value:"fill",className:"cursor-pointer"},{children:i("div",Object.assign({className:"flex items-center gap-2"},{children:[n("div",Object.assign({className:"flex h-8 w-8 shrink-0 items-center justify-center rounded border"},{children:n("div",{className:"h-8 w-8 rounded bg-primary"})})),i("div",Object.assign({className:"flex-1"},{children:[n("div",Object.assign({className:"font-medium"},{children:null===(u=rt.fill)||void 0===u?void 0:u.label})),n("div",Object.assign({className:"text-xs text-muted-foreground"},{children:null===(g=rt.fill)||void 0===g?void 0:g.description}))]}))]}))}))]})})]}))]})),i("div",Object.assign({className:"space-y-1"},{children:[i("div",Object.assign({className:"flex items-center justify-between"},{children:[n($,Object.assign({className:"text-sm font-medium"},{children:"Border radius"})),i("span",Object.assign({className:"text-sm text-muted-foreground"},{children:[a,"px"]}))]})),n(st,{value:[a],onValueChange:([e])=>s({borderRadius:e}),max:50,step:1,className:"w-full"})]}))]}))}))]}))},lt=({referenceRef:e,elementProps:t,onUpdate:a,onReplace:s,onDelete:r,onDownload:c,onCopy:d})=>{var m,h;const[u,g]=o(!1),{refs:p,floatingStyles:f}=z({placement:"top-end",strategy:"fixed",middleware:[ue(8),ge({fallbackPlacements:["bottom","top"],padding:10}),pe({padding:10})],whileElementsMounted:fe});return l(()=>{requestAnimationFrame(()=>{g(!0)})},[]),l(()=>{const t=e.current;t&&p.setReference(t)},[e,p]),n("div",Object.assign({ref:p.setFloating,onMouseDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),className:I("pointer-events-auto","flex items-center gap-1 rounded-lg border bg-background/95 backdrop-blur-sm p-1 shadow-lg","transition-all duration-200 ease-out",u?"opacity-100 translate-y-0":"opacity-0 translate-y-2"),style:f},{children:i(D,Object.assign({delayDuration:0},{children:[i("div",Object.assign({className:"flex items-center gap-0.5 border-r pr-1"},{children:[i(C,{children:[n(R,Object.assign({asChild:!0},{children:n(j,Object.assign({variant:"left"===t.alignment?"secondary":"ghost",size:"icon",className:"h-7 w-7",onClick:()=>a({alignment:"left"})},{children:n(_,{className:"h-4 w-4"})}))})),n(E,{children:"Align left"})]}),i(C,{children:[n(R,Object.assign({asChild:!0},{children:n(j,Object.assign({variant:"center"===t.alignment?"secondary":"ghost",size:"icon",className:"h-7 w-7",onClick:()=>a({alignment:"center"})},{children:n(F,{className:"h-4 w-4"})}))})),n(E,{children:"Align center"})]}),i(C,{children:[n(R,Object.assign({asChild:!0},{children:n(j,Object.assign({variant:"right"===t.alignment?"secondary":"ghost",size:"icon",className:"h-7 w-7",onClick:()=>a({alignment:"right"})},{children:n(L,{className:"h-4 w-4"})}))})),n(E,{children:"Align right"})]})]})),i(C,{children:[n(R,Object.assign({asChild:!0},{children:n(j,Object.assign({variant:"ghost",size:"icon",className:"h-7 w-7",onClick:s},{children:n(P,{className:"h-4 w-4"})}))})),n(E,{children:"Replace"})]}),i(C,{children:[n(R,Object.assign({asChild:!0},{children:n(j,Object.assign({variant:"ghost",size:"icon",className:"h-7 w-7",onClick:c},{children:n(A,{className:"h-4 w-4"})}))})),n(E,{children:"Download"})]}),i(C,{children:[n(R,Object.assign({asChild:!0},{children:n(j,Object.assign({variant:"ghost",size:"icon",className:"h-7 w-7",onClick:d},{children:n(W,{className:"h-4 w-4"})}))})),n(E,{children:"Copy"})]}),n(ae,{orientation:"vertical",className:"h-4"}),n(ot,{fit:null!==(m=t.fit)&&void 0!==m?m:"contain",alt:t.alt||"",borderRadius:null!==(h=t.borderRadius)&&void 0!==h?h:0,onUpdate:a}),i(C,{children:[n(R,Object.assign({asChild:!0},{children:n(j,Object.assign({variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:bg-destructive/10 hover:text-destructive",onClick:r},{children:n(ve,{className:"h-4 w-4"})}))})),n(E,{children:"Delete"})]})]}))}))},ct=({blockId:e,attributes:a,children:s,elementProps:c,onUpdate:u,onDelete:g,onReplace:p,pluginOptions:f})=>{var b;const[v,w]=o(c.sizes),{isElementSelected:x}=d(),j=m({blockId:e}),y=x&&j,N=r(null),O=h(),[k,S]=o(()=>{var e;const t=(null===(e=O.refElement)||void 0===e?void 0:e.getBoundingClientRect().width)||650,n=null==f?void 0:f.maxSizes;return{maxWidth:(null==n?void 0:n.maxWidth)?"number"==typeof n.maxWidth?n.maxWidth:parseInt(String(n.maxWidth).replace(/[^\d]/g,""),10):t,maxHeight:(null==n?void 0:n.maxHeight)?"number"==typeof n.maxHeight?n.maxHeight:parseInt(String(n.maxHeight).replace(/[^\d]/g,""),10):550}});l(()=>{const e=()=>{var e;const t=(null===(e=O.refElement)||void 0===e?void 0:e.getBoundingClientRect().width)||650,n=null==f?void 0:f.maxSizes;S({maxWidth:(null==n?void 0:n.maxWidth)?"number"==typeof n.maxWidth?n.maxWidth:parseInt(String(n.maxWidth).replace(/[^\d]/g,""),10):t,maxHeight:(null==n?void 0:n.maxHeight)?"number"==typeof n.maxHeight?n.maxHeight:parseInt(String(n.maxHeight).replace(/[^\d]/g,""),10):550})};e();const t=new ResizeObserver(e);return O.refElement&&t.observe(O.refElement),window.addEventListener("resize",e),()=>{t.disconnect(),window.removeEventListener("resize",e)}},[O,f]);const C=(e,t)=>{const n=e=>"number"==typeof e?e:parseInt(String(e).replace(/[^\d]/g,""),10),i=n(e.width),a=n(e.height),s=n(t.width),r=n(t.height);if(i<=s&&a<=r)return{width:i,height:a};const o=i/s,l=a/r,c=Math.max(o,l),d=Math.round(i/c),m=Math.round(a/c);return{width:Math.min(d,s),height:Math.min(m,r)}},R={left:"justify-start",center:"justify-center",right:"justify-end"}[null!==(b=c.alignment)&&void 0!==b?b:"center"];return i("div",Object.assign({},a,{className:I("group/image mt-2 relative transition-all w-full flex",R)},{children:[i("div",Object.assign({className:"relative",contentEditable:!1},{children:[n(B,Object.assign({ref:e=>{(null==e?void 0:e.resizableElement)&&e.resizableElement instanceof HTMLElement&&(N.current=e.resizableElement)},style:{position:"relative",outline:y?".125rem solid rgba(0, 0, 0, 0)":"none",outlineColor:y?"hsl(var(--primary))":"none"},size:{width:v.width,height:v.height},onResize:(e,t,n)=>{const i=parseInt(n.style.width,10),a=parseInt(n.style.height,10),s=C({width:i,height:a},{width:k.maxWidth,height:k.maxHeight});w(s)},onResizeStop:(e,t,n)=>{const i=parseInt(n.style.width,10),a=parseInt(n.style.height,10),s=C({width:i,height:a},{width:k.maxWidth,height:k.maxHeight});u({sizes:s})},lockAspectRatio:!0,minWidth:100,minHeight:100,maxWidth:k.maxWidth,maxHeight:k.maxHeight,enableResizing:!!y&&{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:n("div",{className:"h-10 w-2 rounded-full border border-primary bg-primary shadow-sm"}),right:n("div",{className:"h-10 w-2 rounded-full border border-primary bg-primary shadow-sm"})},className:I("rounded-sm")},{children:n("img",{src:c.src,alt:c.alt||"",className:"w-full h-full transition-all duration-200",style:{objectFit:c.fit,borderRadius:`${c.borderRadius}px`},draggable:!1})})),y&&n(lt,{referenceRef:N,elementProps:c,onUpdate:u,onReplace:p,onDelete:g,onDownload:()=>t(void 0,void 0,void 0,function*(){try{const e=yield fetch(c.src),t=yield e.blob(),n=URL.createObjectURL(t),i=document.createElement("a");i.href=n,i.download=`image-${Date.now()}.jpg`,i.click(),URL.revokeObjectURL(n)}catch(e){}}),onCopy:()=>t(void 0,void 0,void 0,function*(){try{const e=yield fetch(c.src),t=yield e.blob();navigator.clipboard&&ClipboardItem?yield navigator.clipboard.write([new ClipboardItem({[t.type]:t})]):T(c.src)}catch(e){T(c.src)}})})]})),s]}))},dt={image:{render:({element:e,attributes:i,children:a,blockId:s})=>{const r=h(),o=u("Image"),{upload:l,progress:d,loading:m}=f(o.upload),{deleteImage:j}=b(o.delete),{preview:y,generatePreview:N,clearPreview:O}=v(),k=c(t=>{g.updateElement(r,{blockId:s,type:"image",props:Object.assign(Object.assign({},e.props),t)})},[r,s,e.props]),S=c(()=>t(void 0,void 0,void 0,function*(){yield j(e);const t=p.getBlockSlate(r,{id:s});if(!t)return;const n=g.getElementPath(r,{blockId:s,element:e});if(!n)return;const i=n?w.parent(t,n):void 0;i&&x.isElement(i[0])&&!w.isEditor(i[0])?g.deleteElement(r,{blockId:s,type:"image",path:n}):p.deleteBlock(r,{blockId:s,focus:!0})}),[r,s,e,j]),I=c(()=>{g.updateElement(r,{blockId:s,type:"image",props:Object.assign(Object.assign({},e.props),{src:null,alt:null})})},[r,s,e.props]),C=c(e=>t(void 0,void 0,void 0,function*(){var t;const n=null===(t=e.target.files)||void 0===t?void 0:t[0];if(!n)return;N(n);const i=yield l(n);k({id:i.id||i.fileId,src:i.url,alt:n.name,sizes:{width:i.width,height:i.height}}),O()}),[l,k,N,O]);return e.props.src?n(ct,Object.assign({blockId:s,elementId:e.id,onUpdate:k,onDelete:S,attributes:i,onReplace:I,elementProps:e.props,pluginOptions:o},{children:a})):n(Ie,Object.assign({onUpload:C,preview:y,progress:d,loading:m,onInsertUrl:()=>{},onInsertFromUnsplash:()=>{},onInsertFromAI:()=>t(void 0,void 0,void 0,function*(){}),attributes:i},{children:a}))}}};export{dt as ImageUI};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import './variables.css';
|
|
1
2
|
import './styles.css';
|
|
2
|
-
import {
|
|
3
|
+
import { applyTheme } from './applyTheme';
|
|
3
4
|
export { AccordionUI } from './accordion';
|
|
4
5
|
export { TableUI } from './table';
|
|
5
6
|
export { HeadingsUI } from './headings';
|
|
@@ -8,10 +9,15 @@ export { ParagraphUI } from './paragraph';
|
|
|
8
9
|
export { CalloutUI } from './callout';
|
|
9
10
|
export { ListsUI } from './lists';
|
|
10
11
|
export { LinkUI } from './link';
|
|
12
|
+
export { MentionUI, MentionDropdown } from './mention';
|
|
11
13
|
export { ImageUI } from './image';
|
|
14
|
+
export { VideoUI } from './video';
|
|
15
|
+
export { EmbedUI } from './embed';
|
|
16
|
+
export { FileUI } from './file';
|
|
12
17
|
export { CodeUI } from './code';
|
|
13
18
|
export { TabsUI } from './tabs';
|
|
14
19
|
export { StepsUI } from './steps';
|
|
15
20
|
export { DividerUI } from './divider';
|
|
16
|
-
export default
|
|
21
|
+
export default applyTheme;
|
|
22
|
+
export { applyTheme };
|
|
17
23
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,iBAAiB,CAAC;AACzB,OAAO,cAAc,CAAC;AACtB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,eAAe,UAAU,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,CAAC"}
|