@yoopta/callout 2.0.1 → 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.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- import { YooEditor } from '@yoopta/editor';
1
+ import { Callout } from './plugin';
2
2
  import { CalloutElement } from './types';
3
- import { Callout } from './ui/Callout';
3
+ import './styles.css';
4
4
  declare module 'slate' {
5
5
  interface CustomTypes {
6
- Editor: YooEditor;
7
6
  Element: CalloutElement;
8
7
  }
9
8
  }
10
9
  export default Callout;
11
10
  export { CalloutElement };
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,cAAc,CAAC;AAEtB,OAAO,QAAQ,OAAO,CAAC;IACrB,UAAU,WAAW;QACnB,OAAO,EAAE,cAAc,CAAC;KACzB;CACF;AAED,eAAe,OAAO,CAAC;AACvB,OAAO,EAAE,cAAc,EAAE,CAAC"}
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{jsx as e}from"react/jsx-runtime";import{createYooptaPlugin as t,generateId as i,getElementClassname as r}from"@yoopta/editor";import{Transforms as a}from"slate";var o="_22OYfqbf";!function(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],a=document.createElement("style");a.type="text/css","top"===i&&r.firstChild?r.insertBefore(a,r.firstChild):r.appendChild(a),a.styleSheet?a.styleSheet.cssText=e:a.appendChild(document.createTextNode(e))}}("._22OYfqbf{background:#f5f7f9;border-radius:5px;color:inherit;font-size:16px;letter-spacing:-.003em;line-height:28px;margin-bottom:4px;margin-left:0;margin-top:4px;padding:12px 14px;position:relative;width:100%}");const n=({attributes:t,children:i,element:a,HTMLAttributes:n})=>e("div",Object.assign({draggable:!1},n,{className:r({element:a,HTMLAttributes:n,className:o})},t,{children:i}));n.displayName="Callout";const l=t({type:"callout",renderer:e=>n,shortcut:"<",defineElement:()=>({id:i(),type:"callout",children:[{text:""}],nodeType:"block"}),createElement:(e,t)=>{var i;const r=Object.assign(Object.assign({},l.getPlugin.defineElement()),t);a.setNodes(e,r,{at:null===(i=e.selection)||void 0===i?void 0:i.anchor})},exports:{markdown:{serialize:(e,t)=>`> ${t}`},html:{serialize:(e,t)=>`<div style="background: #f5f7f9; border-radius: 5px; color: #292929; padding: 12px 14px">${t}</div>`,deserialize:{nodeName:"BLOCKQUOTE"}}},options:{searchString:"callout",displayLabel:"Callout"}});export{l 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};
@@ -0,0 +1,5 @@
1
+ import { YooptaPlugin } from '@yoopta/editor';
2
+ import { CalloutElementProps } from '../types';
3
+ declare const Callout: YooptaPlugin<"callout", CalloutElementProps, Record<string, unknown>>;
4
+ export { Callout };
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
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,2 +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>;
8
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
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,3 +1,8 @@
1
- import { CalloutElement } from '../types';
2
- declare const Callout: import("@yoopta/editor").YooptaPlugin<any, CalloutElement>;
3
- export { Callout };
1
+ /// <reference types="react" />
2
+ import { PluginElementRenderProps } from '@yoopta/editor';
3
+ declare const CalloutRender: {
4
+ ({ element, attributes, children, blockId }: PluginElementRenderProps): JSX.Element;
5
+ displayName: string;
6
+ };
7
+ export { CalloutRender };
8
+ //# sourceMappingURL=Callout.d.ts.map
@@ -0,0 +1 @@
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": "2.0.1",
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",
@@ -14,7 +14,7 @@
14
14
  "dist/"
15
15
  ],
16
16
  "peerDependencies": {
17
- "@yoopta/editor": ">=1.9.18-rc",
17
+ "@yoopta/editor": ">=4.0.0-rc.0",
18
18
  "react": ">=17.0.2",
19
19
  "react-dom": ">=17.0.2",
20
20
  "slate": ">=0.72.3",
@@ -28,9 +28,13 @@
28
28
  "url": "git+https://github.com/Darginec05/Editor-Yoopta.git"
29
29
  },
30
30
  "scripts": {
31
- "test": "node ./__tests__/yoopta-callout.test.js"
31
+ "test": "node ./__tests__/yoopta-callout.test.js",
32
+ "start": "rollup --config rollup.config.js --watch --bundleConfigAsCjs --environment NODE_ENV:development",
33
+ "prepublishOnly": "yarn build",
34
+ "build": "rollup --config rollup.config.js --bundleConfigAsCjs --environment NODE_ENV:production"
32
35
  },
33
36
  "bugs": {
34
37
  "url": "https://github.com/Darginec05/Editor-Yoopta/issues"
35
- }
38
+ },
39
+ "dependencies": {}
36
40
  }