@yoopta/lists 1.9.14-rc → 2.0.0
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/package.json +2 -2
- package/dist/Lists.d.ts +0 -18
- package/dist/index.d.ts +0 -3
- package/dist/index.js +0 -1
- package/dist/types.d.ts +0 -25
- package/dist/ui/BulletedList.d.ts +0 -4
- package/dist/ui/ListItem.d.ts +0 -3
- package/dist/ui/NumberedList.d.ts +0 -4
- package/dist/ui/TodoList.d.ts +0 -4
- package/dist/ui/TodoListItem.d.ts +0 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yoopta/lists",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
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.
|
|
17
|
+
"@yoopta/editor": ">=1.9.18-rc",
|
|
18
18
|
"react": ">=17.0.2",
|
|
19
19
|
"react-dom": ">=17.0.2",
|
|
20
20
|
"slate": ">=0.72.3",
|
package/dist/Lists.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { NumberedList } from './ui/NumberedList';
|
|
2
|
-
import { BulletedList } from './ui/BulletedList';
|
|
3
|
-
import { TodoList } from './ui/TodoList';
|
|
4
|
-
import { YooEditor } from '@yoopta/editor';
|
|
5
|
-
import type { ListChildItemElement, TodoListChildItemElement, TodoListElement, BulletedListElement, NumberedListElement } from './types';
|
|
6
|
-
declare module 'slate' {
|
|
7
|
-
interface CustomTypes {
|
|
8
|
-
Editor: YooEditor;
|
|
9
|
-
Element: ListChildItemElement | TodoListChildItemElement | TodoListElement | BulletedListElement | NumberedListElement;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
declare const Lists: {
|
|
13
|
-
NumberedList: import("@yoopta/editor").YooptaPlugin<import("@yoopta/editor").YooptaPluginBaseOptions, NumberedListElement>;
|
|
14
|
-
BulletedList: import("@yoopta/editor").YooptaPlugin<import("@yoopta/editor").YooptaPluginBaseOptions, BulletedListElement>;
|
|
15
|
-
TodoList: import("@yoopta/editor").YooptaPlugin<import("@yoopta/editor").YooptaPluginBaseOptions, TodoListElement>;
|
|
16
|
-
};
|
|
17
|
-
export default Lists;
|
|
18
|
-
export { NumberedList, BulletedList, TodoList, TodoListElement, BulletedListElement, NumberedListElement };
|
package/dist/index.d.ts
DELETED
package/dist/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t}from"react/jsx-runtime";import{createYooptaPlugin as i,generateId as n,getElementByPath as s,getElementClassname as r,cx as a}from"@yoopta/editor";import{Element as l,Editor as o,Transforms as d,Path as c}from"slate";import{ReactEditor as p}from"slate-react";function h(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css","top"===i&&n.firstChild?n.insertBefore(s,n.firstChild):n.appendChild(s),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e))}}var m="mfUTTw6O";h(".mfUTTw6O{color:inherit;font-size:16px;letter-spacing:-.003em;line-height:28px;list-style-position:inside;padding-bottom:2px;padding-left:0;padding-top:2px;position:relative}.qvO-1a-q{align-items:center;display:flex;flex-grow:0;flex-shrink:0;justify-content:center;margin-right:2px;min-height:calc(1.5em + 6px);user-select:none;width:24px}.xPshFZ5Y{box-sizing:border-box;color:#000;display:inline;flex-shrink:0;font-size:16px;font-style:normal;font-weight:400;line-height:28px;min-width:28px;padding:0 6px 0 4px;word-break:break-word}");const u=({attributes:t,children:i,HTMLAttributes:n})=>e("li",Object.assign({className:m,draggable:!1},n,t,{children:i}));u.displayName="ListItem";const g="list-item",f=i({type:g,renderer:e=>u,extendEditor(e){const{normalizeNode:t}=e;return e.normalizeNode=i=>{const[n,s]=i;if(l.isElement(n)&&n.type===g){const t=n.children[0];l.isElement(t)&&!o.isInline(e,t)&&d.unwrapNodes(e,{at:s.concat(0)})}t(i)},e},shortcut:"-",defineElement:()=>({id:n(),type:"list-item",children:[{text:""}],nodeType:"block"}),placeholder:null,events:{onKeyDown:(e,{hotkeys:t,defaultNode:i})=>r=>{if(!e.selection)return;if(s(e,e.selection.anchor.path,"lowest").type!==g)return;const a=o.above(e,{at:e.selection.anchor,match:e=>l.isElement(e)&&e.type===g});if(!a)return;const{anchor:p}=e.selection,[h,m]=a,[u,y]=o.parent(e,m),b=o.string(e,m),v=o.isEnd(e,p,m),x=o.isStart(e,p,m),N=m.length-1,k=2===N,E=1===N;if(t.isShiftEnter(r))return r.preventDefault(),void e.insertText("\n");if(t.isEnter(r)){if(r.preventDefault(),""===b.trim()){d.unwrapNodes(e,{match:e=>!o.isEditor(e)&&l.isElement(e)&&e.type===u.type,split:!0});const t=N>1?{id:n(),type:g,children:[{text:""}]}:i;return void d.setNodes(e,t,{at:e.selection})}if(!v&&!x)return d.splitNodes(e),void d.setNodes(e,{id:n()});const t=Object.assign(Object.assign({},h),{id:n(),children:[{text:""}]});d.insertNodes(e,t)}else if(t.isBackspace(r)){const[,t]=o.first(e,y),n=0===c.compare(e.selection.anchor.path,t);x&&n&&(r.preventDefault(),d.unwrapNodes(e,{match:e=>l.isElement(e)&&e.type===u.type,split:!0}),d.setNodes(e,i,{at:e.selection}))}else{if(t.isTab(r)){if(r.preventDefault(),k)return;const t=Object.assign(Object.assign({},u),{id:n(),type:u.type,children:[f.getPlugin.defineElement()]});return d.wrapNodes(e,t,{at:m}),void d.setNodes(e,{data:{depth:N+1,skipDrag:!0}},{match:e=>l.isElement(e)&&e.type===u.type})}if(t.isShiftTab(r)){if(r.preventDefault(),E)return;return d.unwrapNodes(e,{match:e=>l.isElement(e)&&e.type===u.type,split:!0}),void d.setNodes(e,{data:{depth:N-1,skipDrag:!0}},{match:e=>l.isElement(e)&&e.type===u.type})}}}},exports:{markdown:{serialize:(e,t)=>`- ${t}`},html:{serialize:(e,t)=>(console.log("children",t),`<li>${t}</li>`),deserialize:{nodeName:"LI"}}}});var y="cN2XzHcO";h(".cN2XzHcO{margin:2px 0;padding-left:18px}");const b=({attributes:t,children:i,element:n,HTMLAttributes:s})=>e("ol",Object.assign({draggable:!1},s,t,{className:r({element:n,HTMLAttributes:s,className:y})},{children:i})),v=i({type:"numbered-list",renderer:e=>b,childPlugin:f,shortcut:"1.",defineElement:()=>({id:n(),type:"numbered-list",children:[f.getPlugin.defineElement()],nodeType:"block",data:{depth:1,skipDrag:!0,skipSettings:!0}}),createElement:(e,t)=>{var i,n;const s=f.getPlugin.defineElement();d.unwrapNodes(e,{match:e=>{var t;return!o.isEditor(e)&&l.isElement(e)&&"list-item"!==e.type&&"todo-list-item"!==e.type&&(null===(t=e.data)||void 0===t?void 0:t.depth)>=1},split:!0}),d.setNodes(e,s,{at:null===(i=e.selection)||void 0===i?void 0:i.anchor});const r=Object.assign(Object.assign({},v.getPlugin.defineElement()),t);d.wrapNodes(e,r,{at:null===(n=e.selection)||void 0===n?void 0:n.anchor})},exports:{markdown:{serialize:(e,t)=>`${t}\n`},html:{serialize:(e,t)=>{var i;return`<ol style="padding-left: ${(null===(i=e.data)||void 0===i?void 0:i.depth)?15*e.data.depth:15}px;">${t}</ol>`},deserialize:{nodeName:"OL"}}},options:{searchString:"order number list",displayLabel:"NumberedList"}});var x="wVFRrWWa";h(".wVFRrWWa{margin:2px 0;padding-left:18px}");const N=({attributes:t,children:i,element:n,HTMLAttributes:s})=>e("ul",Object.assign({draggable:!1},s,{className:r({element:n,HTMLAttributes:s,className:x})},t,{children:i})),k=i({type:"bulleted-list",renderer:e=>N,shortcut:"-",childPlugin:f,defineElement:()=>({id:n(),type:"bulleted-list",children:[f.getPlugin.defineElement()],nodeType:"block",data:{depth:1,skipDrag:!0,skipSettings:!0}}),createElement:(e,t)=>{var i,n;const s=f.getPlugin.defineElement();d.unwrapNodes(e,{match:e=>{var t;return!o.isEditor(e)&&l.isElement(e)&&"list-item"!==e.type&&"todo-list-item"!==e.type&&(null===(t=e.data)||void 0===t?void 0:t.depth)>=1},split:!0}),d.setNodes(e,s,{at:null===(i=e.selection)||void 0===i?void 0:i.anchor});const r=Object.assign(Object.assign({},k.getPlugin.defineElement()),t);d.wrapNodes(e,r,{at:null===(n=e.selection)||void 0===n?void 0:n.anchor})},exports:{markdown:{serialize:(e,t)=>`- ${t}`},html:{serialize:(e,t)=>{var i;return`<ul style="padding-left: ${(null===(i=e.data)||void 0===i?void 0:i.depth)?15*e.data.depth:15}px;">${t}</ul>`},deserialize:{nodeName:"UL"}}},options:{searchString:"bullet list",displayLabel:"BulletedList"}});var E="zLPFpe0C",w="cJeUAnzK",T="YT2kDg7r",z="GzvUWhTl",O="YiyH9UVU";h('.zLPFpe0C{fill:inherit;align-items:flex-start;color:#292929;color:inherit;display:flex;font-size:16px;letter-spacing:-.003em;line-height:24px;margin-bottom:1px;margin-top:1px;padding-bottom:2px;padding-left:2px;padding-top:2px;width:100%}.cJeUAnzK{text-decoration:line-through}.YT2kDg7r{align-items:center;display:flex;flex-grow:0;flex-shrink:0;justify-content:center;margin-right:2px;min-height:30px;user-select:none;width:24px}.YT2kDg7r+.YT2kDg7r{margin-top:1em}.GzvUWhTl{align-items:center;-webkit-appearance:none;appearance:none;border:.1em solid;color:currentColor;cursor:pointer;display:flex;flex-grow:0;flex-shrink:0;height:1.15em;height:16px;place-content:center;justify-content:center;position:relative;transition:background .2s ease-out 0s;width:1.15em;width:16px}.GzvUWhTl:before{background-color:CanvasText;clip-path:polygon(14% 44%,0 65%,50% 100%,100% 16%,80% 0,43% 62%);color:inherit;content:"";height:.65em;transform:scale(0);transform-origin:bottom left;transition:transform .12s ease-in-out;width:.65em}.GzvUWhTl:checked:before{transform:scale(1)}.YiyH9UVU{caret-color:#37352f;max-width:100%;min-width:1px;opacity:1;padding:3px 2px;text-align:left;white-space:pre-wrap;word-break:break-word}');const j="todo-list-item",L=i({type:j,renderer:i=>function({attributes:n,children:s,element:r,HTMLAttributes:o}){const c=r.data.checked;return t("div",Object.assign({draggable:!1},n,o,{className:a(E,{[w]:c})},{children:[e("label",Object.assign({className:T,contentEditable:!1,style:{userSelect:"none"}},{children:e("input",{type:"checkbox",checked:c,className:z,onChange:e=>{const t=p.findPath(i,r);d.setNodes(i,{data:{checked:e.target.checked}},{at:t,match:e=>l.isElement(e)&&e.type===j})}})})),e("span",Object.assign({className:O},{children:s}))]}))},placeholder:null,defineElement:()=>({id:n(),type:"todo-list-item",children:[{text:""}],nodeType:"block",data:{checked:!1}}),events:{onKeyDown:(e,{hotkeys:t,defaultNode:i})=>r=>{var a;if(!e.selection)return;if(s(e,e.selection.anchor.path,"lowest").type!==j)return;const p=o.above(e,{at:null===(a=e.selection)||void 0===a?void 0:a.anchor.path,match:e=>l.isElement(e)&&e.type===j});if(!p)return;const[h,m]=p,[u,g]=o.parent(e,m),f=o.string(e,m),y=o.isEnd(e,e.selection.anchor,m),b=o.isStart(e,e.selection.anchor,m),v=m.length-1,x=2===v,N=1===v;if(t.isShiftEnter(r))return r.preventDefault(),void e.insertText("\n");if(t.isEnter(r)){if(r.preventDefault(),""===f.trim()){d.unwrapNodes(e,{match:e=>l.isElement(e)&&e.type===u.type,split:!0});const t=v>1?{id:n(),type:j,children:[{text:""}],options:{checked:!1}}:i;return void d.setNodes(e,t,{at:e.selection})}if(!y&&!b)return d.splitNodes(e),void d.setNodes(e,{id:n(),data:{checked:!1}},{match:e=>l.isElement(e)&&e.type===j});const t=Object.assign(Object.assign({},h),{id:n(),children:[{text:""}],data:{checked:!1}});d.insertNodes(e,t,{select:!0})}else{if(t.isCmdEnter(r))return r.preventDefault(),void d.setNodes(e,{data:{checked:!h.data.checked}},{at:m,match:e=>l.isElement(e)&&e.type===j});if(t.isBackspace(r)){const[,t]=o.first(e,g),n=0===c.compare(e.selection.anchor.path,t);b&&n&&(r.preventDefault(),d.unwrapNodes(e,{match:e=>l.isElement(e)&&e.type===u.type,split:!0}),d.setNodes(e,i,{at:e.selection}))}else if(t.isTab(r)){if(r.preventDefault(),x)return;const t=Object.assign(Object.assign({},u),{id:n(),type:u.type,children:[L.getPlugin.defineElement()]});d.wrapNodes(e,t,{at:m})}else if(t.isShiftTab(r)){if(r.preventDefault(),N)return;d.unwrapNodes(e,{match:e=>l.isElement(e)&&e.type===u.type,split:!0})}else;}}},options:{checked:!1},exports:{markdown:{serialize:(e,t)=>`[${e.data.checked?"x":" "}] ${t}\n`},html:{serialize:(e,t)=>`<div>[${e.data.checked?"x":" "}] ${t}</div>`}}});var D="Mzo1TbSt";h(".Mzo1TbSt{padding-left:18px}");const P=({attributes:t,element:i,children:n,HTMLAttributes:s})=>e("div",Object.assign({draggable:!1},s,t,{className:r({element:i,HTMLAttributes:s,className:D})},{children:n})),S=i({type:"todo-list",renderer:e=>P,childPlugin:L,shortcut:"[]",defineElement:()=>({id:n(),type:"todo-list",children:[L.getPlugin.defineElement()],nodeType:"block",data:{depth:1,skipDrag:!0,skipSettings:!0}}),createElement:(e,t)=>{var i,n;const s=L.getPlugin.defineElement();d.unwrapNodes(e,{match:e=>{var t;return!o.isEditor(e)&&l.isElement(e)&&"list-item"!==e.type&&"todo-list-item"!==e.type&&(null===(t=e.data)||void 0===t?void 0:t.depth)>=1},split:!0}),d.setNodes(e,s,{at:null===(i=e.selection)||void 0===i?void 0:i.anchor});const r=Object.assign(Object.assign({},S.getPlugin.defineElement()),t);d.wrapNodes(e,r,{at:null===(n=e.selection)||void 0===n?void 0:n.anchor})},exports:{markdown:{serialize:(e,t)=>`${t}`},html:{serialize:(e,t)=>{var i;return`<div style="padding-left: ${(null===(i=e.data)||void 0===i?void 0:i.depth)?15*e.data.depth:15}px;">${t}</div>`}}},options:{searchString:"todo check list",displayLabel:"TodoList"}}),$={NumberedList:v,BulletedList:k,TodoList:S};export{k as BulletedList,v as NumberedList,S as TodoList,$ as default};
|
package/dist/types.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { Modify, YooptaBaseElement, YooptaPluginBaseOptions, YooptaRenderHTMLAttributes } from '@yoopta/editor';
|
|
2
|
-
export type ListOptions = {
|
|
3
|
-
depth: number;
|
|
4
|
-
skipDrag: boolean;
|
|
5
|
-
skipSettings: boolean;
|
|
6
|
-
} & YooptaPluginBaseOptions & YooptaRenderHTMLAttributes;
|
|
7
|
-
export type TodoListItemOptions = {
|
|
8
|
-
checked: boolean;
|
|
9
|
-
};
|
|
10
|
-
export type ListChildItemElement = YooptaBaseElement<'list-item'>;
|
|
11
|
-
export type TodoListChildItemElement = Modify<YooptaBaseElement<'todo-list-item'>, {
|
|
12
|
-
data: TodoListItemOptions;
|
|
13
|
-
}>;
|
|
14
|
-
export type TodoListElement = Modify<YooptaBaseElement<'todo-list'>, {
|
|
15
|
-
children: TodoListChildItemElement[];
|
|
16
|
-
data: ListOptions;
|
|
17
|
-
}>;
|
|
18
|
-
export type BulletedListElement = Modify<YooptaBaseElement<'bulleted-list'>, {
|
|
19
|
-
children: ListChildItemElement[];
|
|
20
|
-
data: ListOptions;
|
|
21
|
-
}>;
|
|
22
|
-
export type NumberedListElement = Modify<YooptaBaseElement<'numbered-list'>, {
|
|
23
|
-
children: ListChildItemElement[];
|
|
24
|
-
data: ListOptions;
|
|
25
|
-
}>;
|
package/dist/ui/ListItem.d.ts
DELETED
package/dist/ui/TodoList.d.ts
DELETED