@yoopta/divider 4.8.4 → 4.8.5-rc.11

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.
@@ -1,7 +1,7 @@
1
- import { YooEditor, YooptaBlockPath } from '@yoopta/editor';
1
+ import { YooEditor, YooptaPathIndex } from '@yoopta/editor';
2
2
  import { DividerElement, DividerElementProps } from '../types';
3
3
  type DividerInsertOptions = DividerElementProps & {
4
- at?: YooptaBlockPath;
4
+ at?: YooptaPathIndex;
5
5
  focus?: boolean;
6
6
  };
7
7
  export type DividerCommands = {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgD,SAAS,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAC1G,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAE/D,KAAK,oBAAoB,GAAG,mBAAmB,GAAG;IAChD,EAAE,CAAC,EAAE,eAAe,CAAC;IACrB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,oBAAoB,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,KAAK,cAAc,CAAC;IACpG,aAAa,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,KAAK,IAAI,CAAC;IACpF,aAAa,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5D,aAAa,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,mBAAmB,CAAC,KAAK,IAAI,CAAC;CAClG,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,eA0B7B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgD,SAAS,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAC1G,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAE/D,KAAK,oBAAoB,GAAG,mBAAmB,GAAG;IAChD,EAAE,CAAC,EAAE,eAAe,CAAC;IACrB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,oBAAoB,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,KAAK,cAAc,CAAC;IACpG,aAAa,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,KAAK,IAAI,CAAC;IACpF,aAAa,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5D,aAAa,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,mBAAmB,CAAC,KAAK,IAAI,CAAC;CAClG,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,eA2B7B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"DividerBlockOptions.d.ts","sourceRoot":"","sources":["../../src/components/DividerBlockOptions.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAgB,SAAS,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAgB,MAAM,UAAU,CAAC;AAQ7D,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,4CAyFzE,CAAC;AAEF,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
1
+ {"version":3,"file":"DividerBlockOptions.d.ts","sourceRoot":"","sources":["../../src/components/DividerBlockOptions.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAgB,SAAS,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAgB,MAAM,UAAU,CAAC;AAQ7D,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,4CA4FzE,CAAC;AAEF,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Divider.d.ts","sourceRoot":"","sources":["../../src/elements/Divider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,wBAAwB,EAAiC,MAAM,gBAAgB,CAAC;AAGzF,QAAA,MAAM,aAAa,+BAAgC,wBAAwB,gBAoD1E,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,CAAC"}
1
+ {"version":3,"file":"Divider.d.ts","sourceRoot":"","sources":["../../src/elements/Divider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,wBAAwB,EAAiC,MAAM,gBAAgB,CAAC;AAGzF,QAAA,MAAM,aAAa,+BAAgC,wBAAwB,gBAmD1E,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,CAAC"}
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{generateId as e,Blocks as t,buildBlockData as i,Elements as o,UI as r,useYooptaEditor as d,useBlockData as n,YooptaPlugin as s}from"@yoopta/editor";import{jsxs as a,jsx as l}from"react/jsx-runtime";import*as c from"react";const p={buildDividerElements:(t,i={})=>({id:e(),type:"divider",children:[{text:""}],props:{color:i.color||"#EFEFEE",theme:i.theme||"solid",nodeType:"void"}}),insertDivider:(e,o={})=>{const{at:r,focus:d}=o,n=p.buildDividerElements(e);t.insertBlock(e,i({value:[n],type:"Divider"}),{at:r,focus:d})},deleteDivider:(e,i)=>{t.deleteBlock(e,{blockId:i})},updateDivider:(e,t,i)=>{o.updateElement(e,t,{type:"divider",props:Object.assign({},i)})}},h=["solid","dashed","dotted","gradient"];function v(e,t){var i={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(i[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(i[o[r]]=e[o[r]])}return i}var y;function u(){return u=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(e[o]=i[o])}return e},u.apply(this,arguments)}"function"==typeof SuppressedError&&SuppressedError;var m,b=function(e){return c.createElement("svg",u({width:15,height:15,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),y||(y=c.createElement("path",{d:"M1.25 7.5a.5.5 0 0 1 .5-.5h11.5a.5.5 0 0 1 0 1H1.75a.5.5 0 0 1-.5-.5Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})))};function g(){return g=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(e[o]=i[o])}return e},g.apply(this,arguments)}var f,w=function(e){return c.createElement("svg",g({width:15,height:15,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),m||(m=c.createElement("path",{d:"M3.625 7.5a1.125 1.125 0 1 1-2.25 0 1.125 1.125 0 0 1 2.25 0Zm5 0a1.125 1.125 0 1 1-2.25 0 1.125 1.125 0 0 1 2.25 0ZM12.5 8.625a1.125 1.125 0 1 0 0-2.25 1.125 1.125 0 0 0 0 2.25Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})))};function x(){return x=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(e[o]=i[o])}return e},x.apply(this,arguments)}var O,E=function(e){return c.createElement("svg",x({width:15,height:15,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),f||(f=c.createElement("path",{d:"M0 7.5A.5.5 0 0 1 .5 7H3a.5.5 0 0 1 0 1H.5a.5.5 0 0 1-.5-.5Zm5.75 0a.5.5 0 0 1 .5-.5h2.5a.5.5 0 0 1 0 1h-2.5a.5.5 0 0 1-.5-.5ZM12 7a.5.5 0 0 0 0 1h2.5a.5.5 0 0 0 0-1H12Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})))};function k(){return k=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(e[o]=i[o])}return e},k.apply(this,arguments)}var j=function(e){return c.createElement("svg",k({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",className:"checkmark_svg__lucide checkmark_svg__lucide-check"},e),O||(O=c.createElement("path",{d:"M20 6 9 17l-5-5"})))};const{ExtendedBlockActions:N,BlockOptionsMenuGroup:C,BlockOptionsMenuItem:D,BlockOptionsSeparator:B}=r,S=({editor:e,block:t,props:i})=>{const r=i=>{o.updateElement(e,t.id,{type:"divider",props:{theme:i}})},d=e=>(null==i?void 0:i.theme)===e;return a(N,Object.assign({onClick:()=>e.setSelection([t.meta.order]),className:"yoopta-divider-options"},{children:[l(B,{}),a(C,{children:[l(D,{children:a("button",Object.assign({type:"button",className:"yoopta-block-options-button yoo-divider-justify-between",onClick:()=>r("solid")},{children:[a("span",Object.assign({className:"yoo-divider-flex"},{children:[l(b,{width:16,height:16,className:"yoo-divider-w-4 yoo-divider-h-4 yoo-divider-mr-2"}),"Line"]})),d("solid")&&l(j,{width:16,height:16,color:"#000",className:"yoo-divider-w-4 yoo-divider-h-4"})]}))}),l(D,{children:a("button",Object.assign({type:"button",className:"yoopta-block-options-button yoo-divider-justify-between",onClick:()=>r("dashed")},{children:[a("span",Object.assign({className:"yoo-divider-flex"},{children:[l(E,{width:16,height:16,color:"tranparent",className:"yoo-divider-w-4 yoo-divider-h-4 yoo-divider-mr-2"}),"Dashed"]})),d("dashed")&&l(j,{width:16,height:16,color:"#000",className:"yoo-divider-w-4 yoo-divider-h-4"})]}))}),l(D,{children:a("button",Object.assign({type:"button",className:"yoopta-block-options-button yoo-divider-justify-between",onClick:()=>r("dotted")},{children:[a("span",Object.assign({className:"yoo-divider-flex"},{children:[l(w,{width:16,height:16,className:"yoo-divider-w-4 yoo-divider-h-4 yoo-divider-mr-2"}),"Dots"]})),d("dotted")&&l(j,{width:16,height:16,color:"#000",className:"yoo-divider-w-4 yoo-divider-h-4"})]}))}),l(D,{children:a("button",Object.assign({type:"button",className:"yoopta-block-options-button yoo-divider-justify-between",onClick:()=>r("gradient")},{children:[a("span",Object.assign({className:"yoo-divider-flex"},{children:[l(b,{width:14,height:16,className:"yoo-divider-w-4 yoo-divider-h-4 yoo-divider-mr-2",color:(null==i?void 0:i.color)||"#EFEFEE"}),"Gradient"]})),d("gradient")&&l(j,{width:16,height:16,color:"#000",className:"yoo-divider-w-4 yoo-divider-h-4"})]}))})]})]}))},F=new s({type:"Divider",elements:{divider:{render:e=>{var t,i,{extendRender:o}=e,r=v(e,["extendRender"]);const s=r.HTMLAttributes||{},{className:c=""}=s,p=v(s,["className"]),h=d(),y=n(r.blockId);if(o)return o(r);const u=(null===(t=r.element.props)||void 0===t?void 0:t.color)||"#e5e7eb",m=(null===(i=r.element.props)||void 0===i?void 0:i.theme)||"solid";return a("div",Object.assign({onClick:e=>{h.setSelection([y.meta.order]),h.setBlockSelected([y.meta.order])}},p,{className:`${c} yoopta-divider`},r.attributes,{contentEditable:!1},{children:[!h.readOnly&&l(S,{block:y,editor:h,props:r.element.props}),(()=>{switch(m){case"dashed":return l("hr",{className:"yoopta-divider-dashed",style:{borderColor:u}});case"dotted":return a("div",Object.assign({className:"yoopta-divider-dotted"},{children:[l("div",{style:{backgroundColor:u}}),l("div",{style:{backgroundColor:u}}),l("div",{style:{backgroundColor:u}})]}));case"gradient":return l("div",{className:"yoopta-divider-gradient",style:{background:`linear-gradient(to right, transparent, ${u}, transparent)`}});default:return l("hr",{className:"yoopta-divider-solid",style:{borderColor:u}})}})(),r.children]}))},props:{nodeType:"void",theme:"solid",color:"#EFEFEE"}}},options:{display:{title:"Divider",description:"Divide your blocks"},shortcuts:["---","divider","line"]},parsers:{html:{deserialize:{nodeNames:["HR"],parse:t=>{const i=t.getAttribute("data-meta-theme")||"solid",o=t.getAttribute("data-meta-color")||"#EFEFEE";return{id:e(),type:"divider",props:{nodeType:"void",theme:i,color:o},children:[{text:""}]}}},serialize:(e,t,i)=>{const{theme:o="solid",color:r="#EFEFEE"}=e.props||{};return`<hr data-meta-theme="${o}" data-meta-color="${r}" style="background-color: #8383e0; height: 1.2px" />`}},markdown:{serialize:(e,t)=>"---\n"}},commands:p,events:{onKeyDown:function(e,t,{hotkeys:i,currentBlock:r}){return t=>{if(i.isCmdShiftD(t)){t.preventDefault();const i=o.getElement(e,r.id,{type:"divider"}),d=h[(h.indexOf(i.props.theme)+1)%h.length];o.updateElement(e,r.id,{type:"divider",props:{theme:d}})}}}}});!function(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===i&&o.firstChild?o.insertBefore(r,o.firstChild):o.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}}(".yoo-divider-mr-2{margin-right:.5rem}.yoo-divider-flex{display:flex}.yoo-divider-h-4{height:1rem}.yoo-divider-w-4{width:1rem}.yoo-divider-justify-between{justify-content:space-between}.yoopta-divider .yoopta-divider-options{color:#000;opacity:0;right:3px;top:3px;transition:opacity .15s ease-in-out}.yoopta-divider:hover .yoopta-divider-options{opacity:1}.yoopta-divider{align-items:center;color:#e5e7eb;display:flex;height:20px;justify-content:center;pointer-events:auto;width:100%}.yoopta-divider-line{border-bottom:2px solid;height:1px;visibility:visible;width:100%}.yoopta-divider-solid{border-bottom:2px solid;border-bottom-style:solid;height:1px;visibility:visible;width:100%}.yoopta-divider-dashed{border-bottom:2px solid;border-bottom-style:dashed;height:1px;visibility:visible;width:100%}.yoopta-divider-dotted{align-items:center;border-bottom:2px solid;border-bottom:none;display:flex;height:3px;justify-content:center;-webkit-user-select:none;-moz-user-select:none;user-select:none;visibility:visible;width:100%}.yoopta-divider-dotted div{border-radius:50%;margin-right:10px;max-height:3px;max-width:3px;min-height:3px;min-width:3px}.yoopta-divider-dotted div:last-child{margin-right:0}.yoopta-divider-gradient{height:2px;width:100%}");export{p as DividerCommands,F as default};
1
+ import{generateId as e,buildBlockData as t,Blocks as i,Elements as o,UI as r,useYooptaEditor as d,useBlockData as n,YooptaPlugin as s}from"@yoopta/editor";import{jsxs as a,jsx as l}from"react/jsx-runtime";import*as c from"react";const p={buildDividerElements:(t,i={})=>({id:e(),type:"divider",children:[{text:""}],props:{color:i.color||"#EFEFEE",theme:i.theme||"solid",nodeType:"void"}}),insertDivider:(e,o={})=>{const{at:r,focus:d}=o,n=p.buildDividerElements(e),s=t({value:[n],type:"Divider"});i.insertBlock(e,s.type,{at:r,focus:d,blockData:s})},deleteDivider:(e,t)=>{i.deleteBlock(e,{blockId:t})},updateDivider:(e,t,i)=>{o.updateElement(e,t,{type:"divider",props:Object.assign({},i)})}},h=["solid","dashed","dotted","gradient"];function v(e,t){var i={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(i[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(i[o[r]]=e[o[r]])}return i}var y;function u(){return u=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(e[o]=i[o])}return e},u.apply(this,arguments)}"function"==typeof SuppressedError&&SuppressedError;var m,b=function(e){return c.createElement("svg",u({width:15,height:15,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),y||(y=c.createElement("path",{d:"M1.25 7.5a.5.5 0 0 1 .5-.5h11.5a.5.5 0 0 1 0 1H1.75a.5.5 0 0 1-.5-.5Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})))};function g(){return g=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(e[o]=i[o])}return e},g.apply(this,arguments)}var f,w=function(e){return c.createElement("svg",g({width:15,height:15,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),m||(m=c.createElement("path",{d:"M3.625 7.5a1.125 1.125 0 1 1-2.25 0 1.125 1.125 0 0 1 2.25 0Zm5 0a1.125 1.125 0 1 1-2.25 0 1.125 1.125 0 0 1 2.25 0ZM12.5 8.625a1.125 1.125 0 1 0 0-2.25 1.125 1.125 0 0 0 0 2.25Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})))};function x(){return x=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(e[o]=i[o])}return e},x.apply(this,arguments)}var O,E=function(e){return c.createElement("svg",x({width:15,height:15,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),f||(f=c.createElement("path",{d:"M0 7.5A.5.5 0 0 1 .5 7H3a.5.5 0 0 1 0 1H.5a.5.5 0 0 1-.5-.5Zm5.75 0a.5.5 0 0 1 .5-.5h2.5a.5.5 0 0 1 0 1h-2.5a.5.5 0 0 1-.5-.5ZM12 7a.5.5 0 0 0 0 1h2.5a.5.5 0 0 0 0-1H12Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})))};function k(){return k=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(e[o]=i[o])}return e},k.apply(this,arguments)}var j=function(e){return c.createElement("svg",k({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",className:"checkmark_svg__lucide checkmark_svg__lucide-check"},e),O||(O=c.createElement("path",{d:"M20 6 9 17l-5-5"})))};const{ExtendedBlockActions:N,BlockOptionsMenuGroup:C,BlockOptionsMenuItem:D,BlockOptionsSeparator:B}=r,F=({editor:e,block:t,props:i})=>{const r=i=>{o.updateElement(e,t.id,{type:"divider",props:{theme:i}})},d=e=>(null==i?void 0:i.theme)===e;return a(N,Object.assign({onClick:()=>e.setPath({current:t.meta.order}),className:"yoopta-divider-options"},{children:[l(B,{}),a(C,{children:[l(D,{children:a("button",Object.assign({type:"button",className:"yoopta-block-options-button yoo-divider-justify-between",onClick:()=>r("solid")},{children:[a("span",Object.assign({className:"yoo-divider-flex"},{children:[l(b,{width:16,height:16,className:"yoo-divider-w-4 yoo-divider-h-4 yoo-divider-mr-2"}),"Line"]})),d("solid")&&l(j,{width:16,height:16,color:"#000",className:"yoo-divider-w-4 yoo-divider-h-4"})]}))}),l(D,{children:a("button",Object.assign({type:"button",className:"yoopta-block-options-button yoo-divider-justify-between",onClick:()=>r("dashed")},{children:[a("span",Object.assign({className:"yoo-divider-flex"},{children:[l(E,{width:16,height:16,color:"tranparent",className:"yoo-divider-w-4 yoo-divider-h-4 yoo-divider-mr-2"}),"Dashed"]})),d("dashed")&&l(j,{width:16,height:16,color:"#000",className:"yoo-divider-w-4 yoo-divider-h-4"})]}))}),l(D,{children:a("button",Object.assign({type:"button",className:"yoopta-block-options-button yoo-divider-justify-between",onClick:()=>r("dotted")},{children:[a("span",Object.assign({className:"yoo-divider-flex"},{children:[l(w,{width:16,height:16,className:"yoo-divider-w-4 yoo-divider-h-4 yoo-divider-mr-2"}),"Dots"]})),d("dotted")&&l(j,{width:16,height:16,color:"#000",className:"yoo-divider-w-4 yoo-divider-h-4"})]}))}),l(D,{children:a("button",Object.assign({type:"button",className:"yoopta-block-options-button yoo-divider-justify-between",onClick:()=>r("gradient")},{children:[a("span",Object.assign({className:"yoo-divider-flex"},{children:[l(b,{width:14,height:16,className:"yoo-divider-w-4 yoo-divider-h-4 yoo-divider-mr-2",color:(null==i?void 0:i.color)||"#EFEFEE"}),"Gradient"]})),d("gradient")&&l(j,{width:16,height:16,color:"#000",className:"yoo-divider-w-4 yoo-divider-h-4"})]}))})]})]}))},M=new s({type:"Divider",elements:{divider:{render:e=>{var t,i,{extendRender:o}=e,r=v(e,["extendRender"]);const s=r.HTMLAttributes||{},{className:c=""}=s,p=v(s,["className"]),h=d(),y=n(r.blockId);if(o)return o(r);const u=(null===(t=r.element.props)||void 0===t?void 0:t.color)||"#e5e7eb",m=(null===(i=r.element.props)||void 0===i?void 0:i.theme)||"solid";return a("div",Object.assign({onClick:e=>{h.setPath({current:y.meta.order,selected:[y.meta.order]})}},p,{className:`${c} yoopta-divider`},r.attributes,{contentEditable:!1},{children:[!h.readOnly&&l(F,{block:y,editor:h,props:r.element.props}),(()=>{switch(m){case"dashed":return l("hr",{className:"yoopta-divider-dashed",style:{borderColor:u}});case"dotted":return a("div",Object.assign({className:"yoopta-divider-dotted"},{children:[l("div",{style:{backgroundColor:u}}),l("div",{style:{backgroundColor:u}}),l("div",{style:{backgroundColor:u}})]}));case"gradient":return l("div",{className:"yoopta-divider-gradient",style:{background:`linear-gradient(to right, transparent, ${u}, transparent)`}});default:return l("hr",{className:"yoopta-divider-solid",style:{borderColor:u}})}})(),r.children]}))},props:{nodeType:"void",theme:"solid",color:"#EFEFEE"}}},options:{display:{title:"Divider",description:"Divide your blocks"},shortcuts:["---","divider","line"]},parsers:{html:{deserialize:{nodeNames:["HR"],parse:t=>{const i=t.getAttribute("data-meta-theme")||"solid",o=t.getAttribute("data-meta-color")||"#EFEFEE";return{id:e(),type:"divider",props:{nodeType:"void",theme:i,color:o},children:[{text:""}]}}},serialize:(e,t,i)=>{const{theme:o="solid",color:r="#EFEFEE"}=e.props||{};return`<hr data-meta-theme="${o}" data-meta-color="${r}" style="background-color: #8383e0; height: 1.2px" />`}},markdown:{serialize:(e,t)=>"---\n"}},commands:p,events:{onKeyDown:function(e,t,{hotkeys:i,currentBlock:r}){return t=>{if(i.isCmdShiftD(t)){t.preventDefault();const i=o.getElement(e,r.id,{type:"divider"}),d=h[(h.indexOf(i.props.theme)+1)%h.length];o.updateElement(e,r.id,{type:"divider",props:{theme:d}})}}}}});!function(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===i&&o.firstChild?o.insertBefore(r,o.firstChild):o.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}}(".yoo-divider-mr-2{margin-right:.5rem}.yoo-divider-flex{display:flex}.yoo-divider-h-4{height:1rem}.yoo-divider-w-4{width:1rem}.yoo-divider-justify-between{justify-content:space-between}.yoopta-divider .yoopta-divider-options{color:#000;opacity:0;right:3px;top:3px;transition:opacity .15s ease-in-out}.yoopta-divider:hover .yoopta-divider-options{opacity:1}.yoopta-divider{align-items:center;color:#e5e7eb;display:flex;height:20px;justify-content:center;pointer-events:auto;width:100%}.yoopta-divider-line{border-bottom:2px solid;height:1px;visibility:visible;width:100%}.yoopta-divider-solid{border-bottom:2px solid;border-bottom-style:solid;height:1px;visibility:visible;width:100%}.yoopta-divider-dashed{border-bottom:2px solid;border-bottom-style:dashed;height:1px;visibility:visible;width:100%}.yoopta-divider-dotted{align-items:center;border-bottom:2px solid;border-bottom:none;display:flex;height:3px;justify-content:center;-webkit-user-select:none;-moz-user-select:none;user-select:none;visibility:visible;width:100%}.yoopta-divider-dotted div{border-radius:50%;margin-right:10px;max-height:3px;max-width:3px;min-height:3px;min-width:3px}.yoopta-divider-dotted div:last-child{margin-right:0}.yoopta-divider-gradient{height:2px;width:100%}");export{p as DividerCommands,M as default};
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@yoopta/divider",
3
- "version": "4.8.4",
3
+ "version": "4.8.5-rc.11",
4
4
  "description": "Divider plugin for Yoopta Editor",
5
5
  "author": "Darginec05 <devopsbanda@gmail.com>",
6
- "homepage": "https://github.com/Darginec05/Editor-Yoopta#readme",
6
+ "homepage": "https://github.com/Darginec05/Yoopta-Editor#readme",
7
7
  "license": "MIT",
8
8
  "private": false,
9
9
  "main": "dist/index.js",
@@ -19,11 +19,11 @@
19
19
  "react-dom": ">=17.0.2"
20
20
  },
21
21
  "publishConfig": {
22
- "registry": "https://registry.yarnpkg.com"
22
+ "registry": "https://registry.npmjs.org"
23
23
  },
24
24
  "repository": {
25
25
  "type": "git",
26
- "url": "git+https://github.com/Darginec05/Editor-Yoopta.git"
26
+ "url": "git+https://github.com/Darginec05/Yoopta-Editor.git"
27
27
  },
28
28
  "scripts": {
29
29
  "test": "node ./__tests__/@yoopta/divider.test.js",
@@ -32,7 +32,7 @@
32
32
  "build": "rollup --config rollup.config.js --bundleConfigAsCjs --environment NODE_ENV:production"
33
33
  },
34
34
  "bugs": {
35
- "url": "https://github.com/Darginec05/Editor-Yoopta/issues"
35
+ "url": "https://github.com/Darginec05/Yoopta-Editor/issues"
36
36
  },
37
- "gitHead": "630fbe31ee28664decb3880d96d29d800340a5b9"
37
+ "gitHead": "d4600b1a31fb39f573dd26868d80c2a53e27c7a4"
38
38
  }