@yoopta/callout 4.0.0-rc.0 → 4.0.0-rc.1

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/index.js CHANGED
@@ -1 +1 @@
1
- import{YooptaPlugin as e}from"@yoopta/editor";import{jsx as o}from"react/jsx-runtime";const t=e=>o("div",Object.assign({"data-element-type":"Callout"},e.attributes,{className:"yoo-c-rounded-md yoo-c-mt-2 yoo-c-p-2 yoo-c-pl-4 yoo-c-leading-7 yoo-c-bg-info yoo-c-text-info-foreground yoo-c-bg-[rgba(245,247,249,1.00)]"},{children:e.children}));t.displayName="Callout";const d=new e({type:"CalloutPlugin",elements:{callout:{render:t}},options:{displayLabel:"Callout",shortcuts:["<"]}});!function(e,o){void 0===o&&(o={});var t=o.insertAt;if(e&&"undefined"!=typeof document){var d=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===t&&d.firstChild?d.insertBefore(r,d.firstChild):d.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}}(".yoo-c-mt-2{margin-top:.5rem}.yoo-c-rounded-md{border-radius:.375rem}.yoo-c-bg-\\[rgba\\(245\\,247\\,249\\,1\\.00\\)\\]{background-color:#f5f7f9}.yoo-c-p-2{padding:.5rem}.yoo-c-pl-4{padding-left:1rem}.yoo-c-leading-7{line-height:1.75rem}");export{d as default};
1
+ import{UI as e,useBlockData as r,useYooptaEditor as o,YooptaPlugin as t}from"@yoopta/editor";import{jsxs as n,jsx as c}from"react/jsx-runtime";import*as l from"react";const i={default:{backgroundColor:"#f5f7f9",color:"#000"},info:{backgroundColor:"#e1f3fe",color:"#08a2e7",borderLeft:"4px solid #08a2e7"},success:{backgroundColor:"#d1fae5",color:"#12b77f",borderLeft:"4px solid #12b77f"},warning:{backgroundColor:"#fef3c9",color:"#f97415",borderLeft:"4px solid #f97415"},error:{backgroundColor:"#fee1e2",color:"#ee4443",borderLeft:"4px solid #ee4443"}};var s,a;function d(){return d=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var o=arguments[r];for(var t in o)Object.prototype.hasOwnProperty.call(o,t)&&(e[t]=o[t])}return e},d.apply(this,arguments)}var u,p=function(e){return l.createElement("svg",d({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:"success_svg__lucide success_svg__lucide-circle-check"},e),s||(s=l.createElement("circle",{cx:12,cy:12,r:10})),a||(a=l.createElement("path",{d:"m9 12 2 2 4-4"})))};function h(){return h=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var o=arguments[r];for(var t in o)Object.prototype.hasOwnProperty.call(o,t)&&(e[t]=o[t])}return e},h.apply(this,arguments)}var g,f,m=function(e){return l.createElement("svg",h({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:"warning_svg__lucide warning_svg__lucide-triangle-alert"},e),u||(u=l.createElement("path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3M12 9v4M12 17h.01"})))};function b(){return b=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var o=arguments[r];for(var t in o)Object.prototype.hasOwnProperty.call(o,t)&&(e[t]=o[t])}return e},b.apply(this,arguments)}var y,v,w=function(e){return l.createElement("svg",b({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:"error_svg__lucide error_svg__lucide-circle-x"},e),g||(g=l.createElement("circle",{cx:12,cy:12,r:10})),f||(f=l.createElement("path",{d:"m15 9-6 6M9 9l6 6"})))};function k(){return k=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var o=arguments[r];for(var t in o)Object.prototype.hasOwnProperty.call(o,t)&&(e[t]=o[t])}return e},k.apply(this,arguments)}var x,j,C=function(e){return l.createElement("svg",k({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:"default_svg__lucide default_svg__lucide-ban"},e),y||(y=l.createElement("circle",{cx:12,cy:12,r:10})),v||(v=l.createElement("path",{d:"m4.9 4.9 14.2 14.2"})))};function O(){return O=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var o=arguments[r];for(var t in o)Object.prototype.hasOwnProperty.call(o,t)&&(e[t]=o[t])}return e},O.apply(this,arguments)}var _=function(e){return l.createElement("svg",O({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:"info_svg__lucide info_svg__lucide-info"},e),x||(x=l.createElement("circle",{cx:12,cy:12,r:10})),j||(j=l.createElement("path",{d:"M12 16v-4M12 8h.01"})))};const{ExtendedBlockActions:E,BlockOptionsMenuGroup:N,BlockOptionsMenuItem:L,BlockOptionsSeparator:B}=e,M=({editor:e,block:r,props:o})=>{const t=o=>{e.blocks.Image.updateElement(r.id,"callout",{theme:o})};null==o||o.theme;const l=e=>(null==o?void 0:o.theme)===e;return n(E,Object.assign({onClick:()=>e.setSelection([r.meta.order])},{children:[c(B,{}),n(N,{children:[c(L,{children:n("button",Object.assign({type:"button",className:"rounded-sm hover:bg-[#37352f14] leading-[120%] px-2 py-1.5 mx-[4px] cursor-pointer w-full flex justify-start",onClick:()=>t("default"),style:{backgroundColor:l("default")?i.default.backgroundColor:void 0}},{children:[c(C,{width:16,height:16,color:i.default.color,className:"w-4 h-4 mr-2"}),"Default"]}))}),c(L,{children:n("button",Object.assign({type:"button",className:"rounded-sm hover:bg-[#37352f14] leading-[120%] px-2 py-1.5 mx-[4px] cursor-pointer w-full flex justify-start",onClick:()=>t("info"),style:{backgroundColor:l("info")?i.info.backgroundColor:void 0}},{children:[c(_,{width:16,height:16,color:i.info.color,className:"w-4 h-4 mr-2"}),"Info"]}))}),c(L,{children:n("button",Object.assign({type:"button",className:"rounded-sm hover:bg-[#37352f14] leading-[120%] px-2 py-1.5 mx-[4px] cursor-pointer w-full flex justify-start",onClick:()=>t("success"),style:{backgroundColor:l("success")?i.success.backgroundColor:void 0}},{children:[c(p,{width:16,height:16,color:i.success.color,className:"w-4 h-4 mr-2"}),"Success"]}))}),c(L,{children:n("button",Object.assign({type:"button",className:"rounded-sm hover:bg-[#37352f14] leading-[120%] px-2 py-1.5 mx-[4px] cursor-pointer w-full flex justify-start",onClick:()=>t("warning"),style:{backgroundColor:l("warning")?i.warning.backgroundColor:void 0}},{children:[c(m,{width:16,height:16,color:i.warning.color,className:"w-4 h-4 mr-2"}),"Warning"]}))}),c(L,{children:n("button",Object.assign({type:"button",className:"rounded-sm hover:bg-[#37352f14] leading-[120%] px-2 py-1.5 mx-[4px] cursor-pointer w-full flex justify-start",onClick:()=>t("error"),style:{backgroundColor:l("error")?i.error.backgroundColor:void 0}},{children:[c(w,{width:16,height:16,color:i.error.color,className:"w-4 h-4 mr-2"}),"Error"]}))})]})]}))},P=({element:e,attributes:t,children:l,blockId:s})=>{const a=r(s),d=o(),{theme:u="default"}=e.props||{},p=i[u];return n("div",Object.assign({"data-element-type":e.type},t,{style:p,className:`yoo-c-rounded-md yoo-c-mt-2 yoo-c-p-2 yoo-c-pl-4 yoo-c-leading-7 yoo-c-bg-info yoo-c-text-info-foreground yoopta-callout yoopta-callout-type-${u}`},{children:[c(M,{block:a,editor:d,props:e.props}),l]}))};P.displayName="Callout";const W=new t({type:"CalloutPlugin",elements:{callout:{render:P,props:{theme:"default"}}},options:{displayLabel:"Callout",shortcuts:["<"]}});!function(e,r){void 0===r&&(r={});var o=r.insertAt;if(e&&"undefined"!=typeof document){var t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===o&&t.firstChild?t.insertBefore(n,t.firstChild):t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}(".yoo-c-mt-2{margin-top:.5rem}.yoo-c-rounded-md{border-radius:.375rem}.yoo-c-p-2{padding:.5rem}.yoo-c-pl-4{padding-left:1rem}.yoo-c-leading-7{line-height:1.75rem}");export{W as default};
@@ -1,7 +1,5 @@
1
1
  import { YooptaPlugin } from '@yoopta/editor';
2
- declare const Callout: YooptaPlugin<"callout", import("slate").Descendant, {
3
- displayLabel: string;
4
- shortcuts: string[];
5
- }>;
2
+ import { CalloutElementProps } from '../types';
3
+ declare const Callout: YooptaPlugin<"callout", CalloutElementProps, Record<string, unknown>>;
6
4
  export { Callout };
7
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugin/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,QAAA,MAAM,OAAO;;;EAWX,CAAC;AAEH,OAAO,EAAE,OAAO,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugin/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAA4B,MAAM,UAAU,CAAC;AAGzE,QAAA,MAAM,OAAO,uEAcX,CAAC;AAEH,OAAO,EAAE,OAAO,EAAE,CAAC"}
package/dist/types.d.ts CHANGED
@@ -1,3 +1,8 @@
1
- import { YooptaBaseElement } from '@yoopta/editor';
2
- export type CalloutElement = YooptaBaseElement<'callout'>;
1
+ import { SlateElement } from '@yoopta/editor';
2
+ export type CalloutPluginElementKeys = 'callout';
3
+ export type CalloutTheme = 'default' | 'success' | 'warning' | 'error' | 'info';
4
+ export type CalloutElementProps = {
5
+ theme: CalloutTheme;
6
+ };
7
+ export type CalloutElement = SlateElement<'callout', CalloutElementProps>;
3
8
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,MAAM,MAAM,cAAc,GAAG,iBAAiB,CAAC,SAAS,CAAC,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,MAAM,MAAM,wBAAwB,GAAG,SAAS,CAAC;AAEjD,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;AAChF,MAAM,MAAM,mBAAmB,GAAG;IAAE,KAAK,EAAE,YAAY,CAAA;CAAE,CAAC;AAC1D,MAAM,MAAM,cAAc,GAAG,YAAY,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC"}
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
- import { RenderElementProps } from 'slate-react';
2
+ import { PluginElementRenderProps } from '@yoopta/editor';
3
3
  declare const CalloutRender: {
4
- (props: RenderElementProps): JSX.Element;
4
+ ({ element, attributes, children, blockId }: PluginElementRenderProps): JSX.Element;
5
5
  displayName: string;
6
6
  };
7
7
  export { CalloutRender };
@@ -1 +1 @@
1
- {"version":3,"file":"Callout.d.ts","sourceRoot":"","sources":["../../src/ui/Callout.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,QAAA,MAAM,aAAa;YAAW,kBAAkB;;CAU/C,CAAC;AAIF,OAAO,EAAE,aAAa,EAAE,CAAC"}
1
+ {"version":3,"file":"Callout.d.ts","sourceRoot":"","sources":["../../src/ui/Callout.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,wBAAwB,EAAiC,MAAM,gBAAgB,CAAC;AAIzF,QAAA,MAAM,aAAa;iDAAgD,wBAAwB;;CAiB1F,CAAC;AAIF,OAAO,EAAE,aAAa,EAAE,CAAC"}
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ import { YooEditor, YooptaBlockData } from '@yoopta/editor';
3
+ import { CalloutElementProps } from '../types';
4
+ type Props = {
5
+ editor: YooEditor;
6
+ block: YooptaBlockData;
7
+ props?: CalloutElementProps;
8
+ };
9
+ declare const CalloutBlockOptions: ({ editor, block, props: calloutProps }: Props) => JSX.Element;
10
+ export { CalloutBlockOptions };
11
+ //# sourceMappingURL=CalloutBlockOptions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CalloutBlockOptions.d.ts","sourceRoot":"","sources":["../../src/ui/CalloutBlockOptions.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAM,SAAS,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAMhE,OAAO,EAAE,mBAAmB,EAA0C,MAAM,UAAU,CAAC;AAKvF,KAAK,KAAK,GAAG;IACX,MAAM,EAAE,SAAS,CAAC;IAClB,KAAK,EAAE,eAAe,CAAC;IACvB,KAAK,CAAC,EAAE,mBAAmB,CAAC;CAC7B,CAAC;AAEF,QAAA,MAAM,mBAAmB,2CAA4C,KAAK,gBA+EzE,CAAC;AAEF,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { CSSProperties } from 'react';
2
+ import { CalloutTheme } from '../types';
3
+ export declare const CALLOUT_THEME_STYLES: Record<CalloutTheme, CSSProperties>;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,YAAY,EAAE,aAAa,CAyBpE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yoopta/callout",
3
- "version": "4.0.0-rc.0",
3
+ "version": "4.0.0-rc.1",
4
4
  "description": "> TODO: description",
5
5
  "author": "Darginec05 <devopsbanda@gmail.com>",
6
6
  "homepage": "https://github.com/Darginec05/Editor-Yoopta#readme",
@@ -35,5 +35,6 @@
35
35
  },
36
36
  "bugs": {
37
37
  "url": "https://github.com/Darginec05/Editor-Yoopta/issues"
38
- }
38
+ },
39
+ "dependencies": {}
39
40
  }